Skip to content
Latchkey

Fly.io "No access token available" (FLY_API_TOKEN) in CI

flyctl authenticates non-interactively with FLY_API_TOKEN. When it is unset, flyctl reports it has no access token and points you at flyctl auth login, which cannot run in CI.

What this error means

A flyctl deploy step fails with "Error: no access token available. Run flyctl auth login to obtain one".

flyctl
Error: no access token available. Run `flyctl auth login` to obtain one

Common causes

No token in the environment

CI cannot run interactive flyctl auth login, so without FLY_API_TOKEN flyctl has no credential.

The token secret was not exposed to the step

The secret exists but was not mapped into the job env, so flyctl sees no token.

How to fix it

Set FLY_API_TOKEN from a secret

  1. Create a deploy token with flyctl tokens create deploy.
  2. Store it as a CI secret named FLY_API_TOKEN.
  3. Expose it to the deploy step (flyctl reads it automatically).
.github/workflows/ci.yml
env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Use a scoped deploy token

A deploy token is scoped to one app, which is safer for CI than a full account token.

Terminal
flyctl tokens create deploy -a my-app

How to prevent it

  • Use an app-scoped deploy token for CI.
  • Keep FLY_API_TOKEN in CI secrets.
  • Set it at the job level so all flyctl calls are authenticated.

Frequently asked questions

What causes "Fly.io "No access token available""?
CI cannot run interactive flyctl auth login, so without FLY_API_TOKEN flyctl has no credential.
How do I fix Fly.io "No access token available"?
Set FLY_API_TOKEN from a secret

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card