# Railway CLI v3: "railway up" fails with "Unauthorized. Please login with railway login" despite RAILWAY_TOKEN

## The problem

In CI (GitHub Actions) and locally, railway up with RAILWAY_TOKEN exported started failing on CLI v3.x with: Error: Unauthorized. Please login with `railway login`, exiting with status 1. Oddly, the deployment itself still triggered and completed - only the CLI's auth check failed. It had worked for months on the same setup; the reporter's temporary fix was pinning the CI to CLI v2.x.

## The verified fix

This was a v3.x CLI regression in how the token was handled in non-interactive environments - the CLI ignored the exported RAILWAY_TOKEN and demanded an interactive login. The Railway team investigated and fixed it in PR #387 (maintainer nebulatgs confirmed "Fixed in #387"). Upgrade the CLI past that fix; if you are pinned to an affected v3.x in the meantime, downgrade to v2.x as the temporary workaround. Note the confusing symptom: the deploy itself succeeds server-side, so only treat the exit code as the signal, and check your CLI version first when you see this. Source: https://github.com/railwayapp/cli/issues/324