You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cli: --dry-run ignores --local, prints remote api.cloudflare.com URL and misses unsupported-local errors #717
Passing --local together with --dry-run ignores --local. --dry-run always prints the remote https://api.cloudflare.com/client/v4/... URL with no indication that the command will run locally, and succeeds even for commands that reject --local at runtime (such as cf d1 query or cf queues list).
Because --dry-run is the documented way for users and agents to preview what a command will do before running it, showing a remote api.cloudflare.com URL makes --local look ignored or unsupported.
Expected behaviour
When --local and --dry-run are combined:
Commands that support local execution should indicate local targeting and state path in the --dry-run JSON instead of printing a remote api.cloudflare.com URL:
Actual output: exits 0 and prints POST https://api.cloudflare.com/client/v4/accounts/<account-id>/d1/database/.../query, whereas running the same command without --dry-run fails with:
┌ APIError
│ [error] This command has no local equivalent. Re-run without --local to use the Cloudflare API. The local explorer API does not implement POST /d1/database/00000000-0000-0000-0000-000000000000/query.
│ 404 Not Found
└
Related to #857 and #861: those also describe --dry-run output that differs from what the command sends (a kebab-case field name in the multipart body in #857, and a query parameter shown but not sent in #861).
With --local, generated --dry-run previews now print the local target ("local": true, "persistTo", and the explorer "path") instead of the remote api.cloudflare.com URL. Commands with no local equivalent now fail during the dry run with the same "This command has no local equivalent" error as the real run. To decide that, the dry run asks Miniflare's own local explorer router in a throwaway, isolated session (temp state, no dev registry, no shared storage), so it matches the real run without copying a route list into cf and without touching project state. It does not use the explorer's OpenAPI document, which lists GET /r2/buckets/{bucket_name} even though that route is not implemented.
Most of the diff is regenerated command files. The change is in generator/plugin/emit/handler.ts, and regenerating changes 3 lines in each of the 2,977 generated commands. The hand-written part is in lib/dry-run.ts, lib/local-runtime.ts and lib/local.ts, with tests.
I saw that PRs need a vouch during the RC phase. If you want this change, could a maintainer vouch for darrellchee so I can open the PR?
Activity
MattieTK commentedon Dec 1, 2026
Related to #857 and #861: those also describe
--dry-runoutput that differs from what the command sends (a kebab-case field name in the multipart body in #857, and a query parameter shown but not sent in #861).darrellchee commentedon Dec 2, 2026
I have a fix for this on my fork: main...darrellchee:cf:fix/issue-717
With
--local, generated--dry-runpreviews now print the local target ("local": true,"persistTo", and the explorer"path") instead of the remoteapi.cloudflare.comURL. Commands with no local equivalent now fail during the dry run with the same "This command has no local equivalent" error as the real run. To decide that, the dry run asks Miniflare's own local explorer router in a throwaway, isolated session (temp state, no dev registry, no shared storage), so it matches the real run without copying a route list into cf and without touching project state. It does not use the explorer's OpenAPI document, which listsGET /r2/buckets/{bucket_name}even though that route is not implemented.Most of the diff is regenerated command files. The change is in
generator/plugin/emit/handler.ts, and regenerating changes 3 lines in each of the 2,977 generated commands. The hand-written part is inlib/dry-run.ts,lib/local-runtime.tsandlib/local.ts, with tests.I saw that PRs need a vouch during the RC phase. If you want this change, could a maintainer vouch for
darrellcheeso I can open the PR?Before and after:
compare.mp4