Skip to content
Latchkey

Wrangler R2 "bucket not found" in CI

The R2 bucket named in your binding does not exist in the account you deploy to. R2 buckets are referenced by name, not id, so create the bucket with the exact name in the binding before deploying.

What this error means

A deploy fails with "The specified bucket does not exist" or "bucket not found" for an r2_buckets binding.

wrangler
✘ [ERROR] A request to the Cloudflare API failed.
  The specified bucket does not exist. [code: 10006]

Common causes

The bucket was never created in this account

R2 does not auto-create buckets on deploy; the bucket_name must already exist in the target account.

A name mismatch or wrong account

A typo in bucket_name, or deploying to a different account, means the referenced bucket cannot be found.

How to fix it

Create the bucket, then bind it

  1. Create the bucket: wrangler r2 bucket create my-bucket.
  2. Set the exact bucket_name in the binding.
  3. Deploy to the account that owns the bucket.
Terminal
npx wrangler r2 bucket create my-bucket
# wrangler.toml:
[[r2_buckets]]
binding = "ASSETS"
bucket_name = "my-bucket"

Verify the bucket list in CI

List buckets to confirm the name exists in the account the token maps to.

Terminal
npx wrangler r2 bucket list

How to prevent it

  • Create R2 buckets before referencing them in bindings.
  • Match bucket_name exactly, including case.
  • Deploy to the account that owns the bucket.

Related guides

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