Skip to content

[BUG] cf workers API commands need the deleted workerd #212

Open

Description

@gatezh

Summary

The claude-code image deletes cf's bundled workerd (README: "Commands that call the Cloudflare API don't need it"). That holds for some API commands but not for the cf workers … group. cf workers scripts list and cf workers scripts search are plain Cloudflare API reads, yet both fail outside a project because they try to load workerd.

Reproduction

In the claude-code image (cf 1.0.0-beta.13, linux-arm64), from an empty directory, signed in with cf auth login:

mkdir /tmp/cf-repro && cd /tmp/cf-repro
export CLOUDFLARE_ACCOUNT_ID=<account id>

cf turnstile widgets list      # OK: prints the widgets
cf workers scripts list        # fails
cf workers scripts search      # fails
┌ Error
│ The package "@cloudflare/workerd-linux-arm64" could not be found, and is
│ needed by workerd.
│
│ If you are installing workerd with npm, make sure that you don't specify the
│ "--no-optional" flag. The "optionalDependencies" package.json feature is used
│ by workerd to install the correct binary executable for your current platform.
└

Verification

  • The empty directory has no package.json or wrangler config, so this isn't the "project has cf as a dev dependency" path from the README.
  • Other API groups (cf turnstile …) work in the same shell, so auth and account selection are fine.

Suggested fix

Two options:

  1. Report upstream to Cloudflare. The workers command group appears to import the local-runtime module eagerly, even for API-only subcommands, and lazy-loading workerd there would fix it for everyone.
  2. Narrow the README claim until that lands, e.g. "Most commands that call the Cloudflare API don't need it; cf workers … currently does. Use wrangler (bunx wrangler deployments list, …) or the Cloudflare MCP server for Workers reads."

Keeping workerd in the image (133 MB) is the other way out, but the size budget in the image roadmap argues against it.

Affected files in this repo

  • claude-code/.devcontainer/Dockerfile (the step that deletes cf's workerd)
  • claude-code/README.md:50 ("Commands that call the Cloudflare API don't need it")

Related

  • docs/plans/2026-10-06-claude-code-image-size-roadmap.md (why workerd was removed)

Activity

  1. gatezh commented on Oct 22, 2026

    @gatezh
    OwnerAuthor

    Reported upstream as cloudflare/cf#390. Root cause: dist/workers-*.mjs statically imports containers-*.mjs, which imports miniflare at the top level. #237 corrects the README in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions