Skip to content

Wrangler deploy fails for Python Worker with "Invalid magic number 0" error (code 10021) #9740

Closed
@MujurID

Description

@MujurID

What versions & operating system are you using?

Wrangler 4.21.2

Please provide a link to a minimal reproduction

https://github.com/cloudflare/python-workers-examples/tree/main/01-hello

Describe the Bug

When attempting to deploy a Python Worker, specifically the 01-hello example from the cloudflare/python-workers-examples repository, the wrangler deploy command fails with an "Invalid magic number 0" error.

Steps to reproduce:

  1. Ensure Wrangler 4.21.2 is installed and configured.
  2. Clone the cloudflare/python-workers-examples repository: git clone https://github.com/cloudflare/python-workers-examples.git
  3. Navigate into the 01-hello example directory: cd python-workers-examples/01-hello
  4. Run the deployment command: wrangler deploy

Observed behaviour:
The deployment process fails, returning an API error from Cloudflare, with the following message:

X [ERROR] A request to the Cloudflare API (/accounts/[REDACTED]/workers/scripts/hello-python) failed.

  Uncaught Error: Invalid magic number 0, expected 1886286592
    at null.<anonymous> (pyodide-internal:snapshot:313:15) in decodeSnapshot
    at null.<anonymous> (pyodide-internal:snapshot:20:30)
   [code: 10021]


  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

Expected behaviour:
The Python Worker should deploy successfully to Cloudflare Workers without errors, and the API request should complete as expected.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions