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.
✘ [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
- Copy the account id from the Cloudflare dashboard URL or
wrangler whoami. - Store it as a secret and expose it in the deploy step env.
- Re-run the deploy so Wrangler resolves the account non-interactively.
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.
name = "app"
account_id = "0123456789abcdef0123456789abcdef"
main = "src/index.ts"How to prevent it
- Always set
CLOUDFLARE_ACCOUNT_IDin CI when a token spans accounts. - Pin
account_idin wrangler.toml for reproducible deploys. - Run
wrangler whoamito confirm which accounts a token can reach.