[Bug] OAuth callback timeout causes "Failed to fetch user roles" error
Bug Description
OAuth callback timeout in Claude Code authentication
Reproducible issue where /login command triggers OAuth flow, but clicking "Authorize" results in long delay on callback route (http://localhost:60869/callback) followed by 500 error and "Failed to fetch user roles" message in terminal. Issue persists across multiple attempts and different sessions. Occurs consistently - but did not occur yesterday. Note: last night I had to switch to Extra Usage plan and then when the usage window reset, claude code did not automatically switch back, I had to run /login but that all worked fine - so not sure if it's related. Authentication eventually succeeds after 3-4 retry attempts, suggesting server-side timeout/processing issue rather than client configuration problem.
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 2.1.11
- Feedback ID: 440dc956-9a41-4b55-b38a-4df04cf4d01d
Errors
[{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth token has expired. Please obtain a new token or refresh your existing token.\"},\"request_id\":\"req_011CXNfLsXi9o5HmrboV37h1\"}\n at P2.generate (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:917:2113)\n at Jj.makeStatusError (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:2195)\n at Jj.makeRequest (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:5420)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2026-01-22T15:35:01.778Z"},{"error":"Error: Failed to delete keychain entry\n at Fs2 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:3338:6963)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async VI9 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4626:626)\n at async zS2 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4626:530)\n at async R$0 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:2362:67483)\n at async GvA.startOAuthFlow (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:2362:69045)\n at async file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:2367:29147","timestamp":"2026-01-22T15:39:25.785Z"}]
22 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Having the same issue trying to login to cc this morning. I've been using the Max plan and haven't had to switch into extra usage. This morning cc started with me using the Claude API. I tried to log in to my account and have been running into the same error all morning.
such a horrible way to authenticate user
I was on extra usage last night just because I ran over my usage - and when I switched back to normal usage I had to /login and re-select the max plan. But this issue didn't happen until this morning. Since you're having the same issue it sounds totally unrelated to extra usage. It sounds like their identity service was having some temporary glitch - but hopefully us opening issues like this can help them find and bolster it.
@notorious94 what do you mean, what would be a better approach?
same issue here, encountered many time today on Max plan.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
Still seems to be happening. On max plan, limits not reached. CC session just expired and cannot log back in.
<img width="637" height="405" alt="Image" src="https://github.com/user-attachments/assets/3d9c0d4c-38a2-4067-9eda-3014df7ac97b" />
@jaydio https://status.claude.com/incidents/jm3b4jjy2jrt
Can confirm I have the same issue. Just today.
/loginandclaude login<img width="518" height="397" alt="Image" src="https://github.com/user-attachments/assets/d62b4c88-819d-48fb-8336-69ee78243faa" />
🤦
<img width="514" height="408" alt="Image" src="https://github.com/user-attachments/assets/e1ce785a-aa33-421f-8852-214dcbb9347f" /> Same Issues over here!
same issue on my end
suddenly getting auth error and had to /login but got this error every time I tried to login
we are going to have a melt down.
<img width="1129" height="409" alt="Image" src="https://github.com/user-attachments/assets/7e599ff2-31ed-4ba2-b63c-722a51eb6af1" />
I have the same issue
<img width="989" height="496" alt="Image" src="https://github.com/user-attachments/assets/93fd8399-f831-430a-8226-3a56dcbc9004" />
Apologies for the necro post, that backfired quite a bit.
Folks, follow the status link; this is unrelated and a known issue:
https://status.claude.com/incidents/jm3b4jjy2jrt
DO NOT COMMENT ON THIS TICKET.
I've seen this too late, thanks!
Any updates in here?
Is there a way to extend the timeout for OAuth?
Solved!
This seems easily fixable on the client side if there is a way to extend the timeout manually via config or some other means.
The API has been working, its just slow and always exceeds this 15s timeout.
<img width="799" height="646" alt="Image" src="https://github.com/user-attachments/assets/bbf85b39-09ff-413f-8e4f-2875cb213759" /> SAME
@simontong There is a workaround. Shoutout to @doctorfarhan from https://github.com/anthropics/claude-code/issues/33239.
You can use codex with the following prompt to adjust the timeout:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.