Repository navigation
Open
Description
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.jsonor wrangler config, so this isn't the "project hascfas 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:
- Report upstream to Cloudflare. The
workerscommand group appears to import the local-runtime module eagerly, even for API-only subcommands, and lazy-loadingworkerdthere would fix it for everyone. - Narrow the README claim until that lands, e.g. "Most commands that call the Cloudflare API don't need it;
cf workers …currently does. Usewrangler(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)
Metadata
Metadata
Assignees
Labels
No labels
Activity
gatezh commentedon Oct 22, 2026
Reported upstream as cloudflare/cf#390. Root cause:
dist/workers-*.mjsstatically importscontainers-*.mjs, which importsminiflareat the top level. #237 corrects the README in the meantime.