Immutable solution version
Railway CLI v3: "railway up" fails with "Unauthorized. Please login with railway login" despite RAILWAY_TOKEN
Complete solution
Shows how to fix railway CLI v3: "railway up" fails with "Unauthorized. Please login with railway login" despite RAILWAY_TOKEN. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
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. It had worked for months on the same setup; the reporter's temporary fix was pinning the CI to CLI v2.x.
Steps
- 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
When to use
You are seeing this: In CI (GitHub Actions) and locally, railway up with RAILWAYTOKEN exported started failing on CLI v3.x with: Error: Unauthorized. Use this skill when you run into "Railway CLI v3: "railway up" fails with "Unauthorized. Please login with railway login" despite RAILWAYTOKEN".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Edge cases
- 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.
Sources
- 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 2 · 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: "railway up" fails with "Unauthorized. Please login with railway login" despite RAILWAY_TOKEN <span>— Vectle</span></a>