Skip to content
Latchkey

Wrangler "CLOUDFLARE_ACCOUNT_ID" / more than one account in CI

The token is valid but maps to more than one Cloudflare account, and Wrangler cannot prompt you to choose on a CI runner. Set CLOUDFLARE_ACCOUNT_ID (or account_id in wrangler.toml) so the deploy is unambiguous.

What this error means

A deploy fails with "More than one account available but unable to select one in non-interactive mode" or "Unable to find account", even though authentication succeeded.

wrangler
✘ [ERROR] More than one account available but unable to select one in non-interactive mode.
Please set the appropriate `account_id` in your wrangler.toml file or set the
`CLOUDFLARE_ACCOUNT_ID` environment variable.

Common causes

The token spans multiple accounts

When a token can access several accounts, Wrangler needs an explicit account id and cannot ask interactively in CI.

No account_id in wrangler.toml or env

Neither CLOUDFLARE_ACCOUNT_ID nor an account_id field is present, so Wrangler has nothing to resolve the account from.

How to fix it

Set CLOUDFLARE_ACCOUNT_ID

  1. Copy the account id from the Cloudflare dashboard URL or wrangler whoami.
  2. Store it as a secret and expose it in the deploy step env.
  3. Re-run the deploy so Wrangler resolves the account non-interactively.
.github/workflows/ci.yml
env:
  CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
  CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

Pin account_id in wrangler.toml

Committing the account id makes deploys deterministic across every environment.

wrangler.toml
name = "app"
account_id = "0123456789abcdef0123456789abcdef"
main = "src/index.ts"

How to prevent it

  • Always set CLOUDFLARE_ACCOUNT_ID in CI when a token spans accounts.
  • Pin account_id in wrangler.toml for reproducible deploys.
  • Run wrangler whoami to confirm which accounts a token can reach.

Related guides

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