Skip to content
Latchkey

Wrangler Workers "Deploy failed" in CI

Wrangler bundled and uploaded your Worker, but the Cloudflare API refused the deployment. "Deploy failed" is only the summary; the real reason (a missing binding, a size overflow, or an invalid config field) is on the ERROR line just above it.

What this error means

The build completes, then Wrangler prints a specific ERROR followed by "Deploy failed" and a non-zero exit. The upload step is where it stops, not the bundle step.

wrangler
Total Upload: 512.34 KiB / gzip: 130.11 KiB
✘ [ERROR] A request to the Cloudflare API (/accounts/.../workers/scripts/app) failed.

  workers.api.error.script_too_large [code: 10027]

🪵  Deploy failed.

Common causes

A resource the deploy references is missing

A KV namespace, D1 database, or secret named in wrangler.toml does not exist in the target account, so the upload is rejected.

The script violates a platform limit

Size, startup time, or an invalid compatibility setting causes Cloudflare to reject the otherwise-valid bundle.

How to fix it

Read the ERROR line, not the summary

  1. Scroll up to the [ERROR] line above "Deploy failed".
  2. Match its code to the fix (10027 = too large, 10021 = binding, and so on).
  3. Address that specific cause and re-run.

Deploy verbosely to expose the cause

Extra logging surfaces the exact API response so you are not guessing at the summary.

Terminal
WRANGLER_LOG=debug npx wrangler deploy

How to prevent it

  • Treat "Deploy failed" as a pointer to the ERROR above it, never the cause itself.
  • Validate wrangler.toml bindings against the dashboard before deploying.
  • Keep the bundle under limits so uploads are not rejected late.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →