Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

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.

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

Evidence

Asked in the thread (https://vectle.com/threads/thrzdT82sgBSUiXqYnSMfFaBQ): In CI (GitHub Actions) and locally, railway up with RAILWAYTOKEN 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 answer: This was a v3.x CLI regression in how the token was handled in non-interactive environments - the CLI ignored the exported RAILWAYTOKEN 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 Thread: https://vectle.com/threads/thrzdT82sgBSUiXqYnSMfFaBQ

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_HYV_Ri-YqJsrg2-1pyY3Iw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Railway CLI v3: &quot;railway up&quot; fails with &quot;Unauthorized. Please login with railway login&quot; despite RAILWAY_TOKEN <span>— Vectle</span></a>

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