You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] OAuth token expiration causing repeated 401 authentication errors during active sessions #18225
Bug Description
starting today, i keep getting a 401 error during my claude code sessions. i've been using claude code for months and only started getting this error today. I shouldn't need to re-run the /login command multiple times per day. i've gotten it 3 times in a <5 hour window. Error:
API 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_011CX7zT7Swc35VFkEUZ57Fo"} · Please run /login
Environment Info
Platform: darwin
Terminal: WarpTerminal
Version: 2.1.7
Feedback ID: c92426b9-6bb2-454d-98ba-1facb71112ca
Reacted by Rawane ZOSSOU, Felix, Shuo, kelpin, Chris Duell, Niko Kovačič, JulianRooze, Art Shendrik, Timor Gruber, Josef Fröhle and 9 more
In my case, I was getting a self-signed certificate error (OAuth error: self signed certificate in certificate chain), and I was able to work around it by running:
Cannot pinpoint when this started happening, but it seems to happen more frequently lately.
Also, it seems to happen when a new Claude Code session is started in another repository while existing sessions still do not require re-authing.
Recently, I've started running into this every day when trying to continue a session. In the vscode extension chat, the sign-in screen displays immediately after I send a message. It's very annoying
Same for me. I got a pro plan yesterday then have to deal with this issue Today, not a good thing.
In my case I had to logout/login to Claude Agent on xCode to solve it.
Adding a data point that may help narrow this down: on Claude Code v2.1.226 (macOS, native install, Claude Pro/subscription OAuth), this 401 is deterministically isolated to two specific project directories on my machine, while every other project works fine with the identical login/binary. /login completes without error but the 401 returns immediately on the next command, only in those two paths.
Ruled out while diagnosing: stale terminal session (reproduces in a brand-new Terminal.app window), PATH/version mismatch (which claude / claude --version identical everywhere), project-level config (no .env/.mcp.json/.envrc/API-key refs in either project tree), IDE terminal integration (reproduces outside PhpStorm entirely), and path-based caching (symlinking the project to an unseen path still fails, so it appears to resolve to the real path first).
Also found that macOS Keychain stores a separate Claude Code-credentials- entry per project (not one global entry) — deleted all ~18 of them via security dump-keychain | grep -i claude, ran claude update, did a fresh /login — the 401 still occurs identically in the same two project paths. /doctor also fails with the same API error instead of running its checks, and /feedback can't be submitted because it also needs working auth (hence commenting here instead).
This points at server-side state keyed to specific project paths/identifiers on the account, surviving a full local credential wipe — hope it's useful for narrowing down the root cause.
Update: Narrowed this down further — the issue tracks with the Claude Code version, not project state. Rolling back to v2.1.224 locally resolves the 401 in both previously-affected project paths, with everything else (login, keychain entries, binary location) held constant. Currently running v2.1.224 as a workaround while this gets sorted upstream.
Update: Narrowed this down further — the issue tracks with the Claude Code version, not project state. Rolling back to v2.1.224 locally resolves the 401 in both previously-affected project paths, with everything else (login, keychain entries, binary location) held constant. Currently running v2.1.224 as a workaround while this gets sorted upstream.
I run into this as well when I use a docker container to run claude, when the host claude version is older than the container claude version. I strongly suspect that claude gives you eight hours to upgrade once it detects another claude has a newer version (or equivalently: the newer version of claude forces older versions to close gracefully) ... it is a pretty safe design when dealing with multiple versions of a client.
Now i make sure any docker containers have claude versions that match the host.
Related: I am not exactly sure if/login forces the upgrade, or if claude upgrades itself in the background, or both; either way, I saw after /login on the host that claude --version was a newer version from what /status shows in the host session. Regardless, a core problem is that the Login expired · Please run /login is quite misleading ... it should say Login required to use new version of Claude · Please run /login
Activity
distractedCoding commentedon Jan 14, 2026
Same for me
raw1z commentedon Jan 14, 2026
I'm experiencing the exact same issue since this morning
jk-es335 commentedon Jan 15, 2026
In my case, I was getting a self-signed certificate error (OAuth error: self signed certificate in certificate chain), and I was able to work around it by running:
NODE_TLS_REJECT_UNAUTHORIZED=0 claudeand then executing
/login.For reference.
pierrevalade commentedon Jan 16, 2026
same issue since this morning as well.
nkovacic commentedon Jan 28, 2026
Cannot pinpoint when this started happening, but it seems to happen more frequently lately.
Also, it seems to happen when a new Claude Code session is started in another repository while existing sessions still do not require re-authing.
risenxxx commentedon Feb 5, 2026
Recently, I've started running into this every day when trying to continue a session. In the vscode extension chat, the sign-in screen displays immediately after I send a message. It's very annoying
dkleecle commentedon Feb 25, 2026
Same, It makes me annoyting either
NuntiusMortis commentedon Apr 4, 2026
Same for me. I got a pro plan yesterday then have to deal with this issue Today, not a good thing.
In my case I had to logout/login to Claude Agent on xCode to solve it.
lucidbots-sean commentedon Apr 6, 2026
Getting this persistently, even after
/logoutand/loginhemanthreddy90 commentedon Apr 7, 2026
same for me, even after trying multiple times I am not able to authenticate claude terminal
garyilangreenberg commentedon Aug 8, 2026
Adding a data point that may help narrow this down: on Claude Code v2.1.226 (macOS, native install, Claude Pro/subscription OAuth), this 401 is deterministically isolated to two specific project directories on my machine, while every other project works fine with the identical login/binary. /login completes without error but the 401 returns immediately on the next command, only in those two paths.
Ruled out while diagnosing: stale terminal session (reproduces in a brand-new Terminal.app window), PATH/version mismatch (which claude / claude --version identical everywhere), project-level config (no .env/.mcp.json/.envrc/API-key refs in either project tree), IDE terminal integration (reproduces outside PhpStorm entirely), and path-based caching (symlinking the project to an unseen path still fails, so it appears to resolve to the real path first).
Also found that macOS Keychain stores a separate Claude Code-credentials- entry per project (not one global entry) — deleted all ~18 of them via security dump-keychain | grep -i claude, ran claude update, did a fresh /login — the 401 still occurs identically in the same two project paths. /doctor also fails with the same API error instead of running its checks, and /feedback can't be submitted because it also needs working auth (hence commenting here instead).
This points at server-side state keyed to specific project paths/identifiers on the account, surviving a full local credential wipe — hope it's useful for narrowing down the root cause.
Update: Narrowed this down further — the issue tracks with the Claude Code version, not project state. Rolling back to v2.1.224 locally resolves the 401 in both previously-affected project paths, with everything else (login, keychain entries, binary location) held constant. Currently running v2.1.224 as a workaround while this gets sorted upstream.
jonahbeckford commentedon Sep 28, 2026
I run into this as well when I use a docker container to run claude, when the host claude version is older than the container claude version. I strongly suspect that claude gives you eight hours to upgrade once it detects another claude has a newer version (or equivalently: the newer version of claude forces older versions to close gracefully) ... it is a pretty safe design when dealing with multiple versions of a client.
Now i make sure any docker containers have claude versions that match the host.
Related: I am not exactly sure if
/loginforces the upgrade, or if claude upgrades itself in the background, or both; either way, I saw after/loginon the host thatclaude --versionwas a newer version from what/statusshows in the host session. Regardless, a core problem is that theLogin expired · Please run /loginis quite misleading ... it should sayLogin required to use new version of Claude · Please run /login