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
OAuth token not persisted/refreshed for --print mode, breaks automation #37402
Escalation — This is getting worse and makes Claude Code unusable for automation
Update: This issue is now occurring multiple times per day, not just every 8 hours. The token seems to expire even more frequently now.
Real-world impact:
We run 4 Claude Code workers via Paperclip AI (agent orchestration platform)
Every time the token expires, ALL workers fail simultaneously
The .credentials.json file gets completely wiped (all fields null/empty)
There is NO refresh token stored, so no automatic recovery is possible
We have to manually run /login every few hours, which defeats the purpose of automation
We're paying for Claude Code Pro but can't use it for its primary use case
Evidence from today (2026-03-22):
Login at ~11:00 → Token expired by ~12:11 (just over 1 hour!)
Multiple worker runs failed with "Not logged in · Please run /login"
All 4 workers producing identical "claude_auth_required" errors
Screenshot shows 15+ consecutive failed runs
What we need:
Immediate:claude --print should auto-refresh tokens using OAuth refresh_token
Short-term:claude auth refresh CLI command for automation
Minimum: Store the refresh_token in .credentials.json so we can refresh manually
This is a critical blocker for any production use of Claude Code in automation. Without a fix, we'll need to discontinue our subscription as the product is unusable for 24/7 operations.
Third escalation — 7th forced re-login today, token lasted less than 5 minutes this time
Just did /login again. Token expired before I could even finish reading the previous comment. This is now completely unusable.
We are seriously considering canceling our Claude Code Max subscription. We've spent the entire day fighting this bug instead of doing actual work. Not a single task was completed successfully by our automation today because of this.
Still happening consistently. This time the token expired mid-session while the agent was actively executing commands (last successful bash call returned 200 OK, then immediately got 401 authentication_error: "OAuth authentication is currently not supported").
Token expired at ~20:45 UTC — 15 minutes into session
Error: API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}}
Required manual /login to restore
This is the same pattern reported in the original issue — tokens expire every 10-15 minutes. This makes autonomous overnight operation impossible. We have trading bots and worker automation that depends on Claude Code sessions staying alive.
Impact: Blocks all Paperclip AI worker automation, overnight monitoring, and autonomous task execution.
Environment: Windows 11 Pro, Claude Code CLI, interactive mode (not just --print).
2x more OAuth expiry in 5 minutes — 2026-03-22 ~20:50-20:55 UTC
This is getting critical. Two more token expirations within a 5-minute window, each requiring manual /login. The user is trying to set up overnight automation and cannot leave the terminal because tokens keep dying.
Session timeline:
20:30 — session start
20:45 — 1st expiry (reported in previous comment)
20:50 — 2nd expiry (after /login restore)
20:55 — 3rd expiry (after another /login restore)
That's 3 forced logouts in 25 minutes of active usage. Each time the tool was mid-execution (writing files, making API calls) when it died.
This is a severe UX regression. The user literally cannot step away from the keyboard because the session dies every few minutes. Autonomous overnight workflows are completely blocked. This is not an edge case — it's core interactive usage breaking repeatedly.
Error:API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}}
Please prioritize this fix. Users running Claude Code for production automation are severely impacted.
4th OAuth expiry in ~30 minutes — 2026-03-22 ~21:00 UTC
This is now the FOURTH forced logout in a single 30-minute session. The token is expiring every 5-8 minutes now (getting worse, not better).
Timeline of this session alone:
20:30 — session start
20:45 — 1st expiry (~15 min)
20:50 — 2nd expiry (~5 min after re-login)
20:55 — 3rd expiry (~5 min after re-login)
21:00 — 4th expiry (~5 min after re-login)
The intervals are SHRINKING. First was 15 min, now it's consistently ~5 min. Each /login restores a token that dies almost immediately.
The user is unable to perform any meaningful work. Background processes cannot be monitored. Overnight automation is impossible. This is a P0 regression — the product is effectively non-functional for sessions longer than 5 minutes.
Credentials behavior: The credentials file gets wiped (all fields null) with no refresh_token being stored. This suggests the OAuth flow is issuing short-lived access tokens without refresh tokens.
Environment: Windows 11 Pro, Claude Code CLI latest, interactive mode.
cc @anthropics/claude-code-team — this needs urgent attention.
Token expired AGAIN. 5th time in ~60 minutes. User went to sleep and had to come back to re-login because token died while agent was doing overnight monitoring work.
This is completely unusable for any automation or even extended interactive sessions. Please fix urgently.
Morning update — 2026-03-23: Token expired overnight, zero autonomous work possible
As predicted, the OAuth token expired overnight. The user woke up to dead Claude Code sessions and had to manually /login twice just to start the morning.
Overnight impact:
NightWatch monitoring daemon ran but couldn't restart workers when needed
All Phoenix AI workers (autonomous coding agents) stayed dead since ~21:00 UTC yesterday
The only reason trading continued is because trading bots are independent Python processes — NOT because Claude Code was functional
Session count since yesterday: 6+ forced /login re-authentications in ~10 hours. The token never survived more than 15 minutes.
This is day 2 of this regression. Any ETA on a fix?
Update 2026-03-24 — Issue confirmed on v2.1.81, fix from #24317 does NOT resolve this
Environment: Windows 11 Pro, Claude Code v2.1.81, Max plan (20x tier), 3 concurrent claude.exe processes (1 interactive + 2 --print workers spawned by Paperclip AI / Phoenix)
What we observed today
Token is currently valid (8h lifetime, refresh token present). But the pattern from previous days continues:
Token expires or gets wiped during concurrent --print usage
.credentials.json fields become null/empty
All workers die simultaneously
Only manual /login fixes it
Root cause confirmed
This matches the deep source analysis by @LARIkoz in #24317:
The proper-lockfile in v2.1.81 has only 5 retries with ~7.5s max wait — insufficient for 3+ concurrent processes
The 5-second Keychain cache TTL creates stale token windows
No Windows Credential Manager integration — Windows doesn't have macOS Keychain, so file-based .credentials.json is the only storage, making the race condition worse
What we need (from a paying Max subscriber running production automation)
Immediate: Increase lock retry budget to 15-20 retries with exponential backoff (currently 5 retries)
Short-term:claude auth refresh CLI command for automation pre-warming
Alternative: Support ANTHROPIC_API_KEY within subscription billing (not separate API billing)
Our workaround attempts
We cannot use the CLAUDE_CODE_OAUTH_TOKEN workaround (blocked server-side since Feb 2026)
We cannot use tmux isolation (Windows)
Pre-warming tokens before batch doesn't help — workers run 24/7, not in batches
The only option is manual /login every few hours, which defeats autonomous operation
This is a subscription-threatening blocker. We're paying $100/mo for Max specifically for automation, but the product requires manual intervention every few hours. Please prioritize.
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.
Activity
github-actions commentedon Mar 22, 2026
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
honzastim commentedon Mar 22, 2026
This is a new bug. Today my workers got the same login error after just 1 hour. Unbelievable.
honzastim commentedon Mar 22, 2026
Escalation — This is getting worse and makes Claude Code unusable for automation
Update: This issue is now occurring multiple times per day, not just every 8 hours. The token seems to expire even more frequently now.
Real-world impact:
.credentials.jsonfile gets completely wiped (all fields null/empty)/loginevery few hours, which defeats the purpose of automationEvidence from today (2026-03-22):
What we need:
claude --printshould auto-refresh tokens using OAuth refresh_tokenclaude auth refreshCLI command for automation.credentials.jsonso we can refresh manuallyThis is a critical blocker for any production use of Claude Code in automation. Without a fix, we'll need to discontinue our subscription as the product is unusable for 24/7 operations.
/cc @anthropics/claude-code-team
honzastim commentedon Mar 22, 2026
Second Escalation — Token now expires every 10-15 MINUTES
This is getting exponentially worse. Since my last comment 2 hours ago:
/loginwith browser OAuth flowTimeline today (2026-03-22):
That's 6+ forced re-logins in one day, with token lifetime shrinking each time.
What's happening technically:
~/.claude/.credentials.jsongets wiped (all fields become null/empty)refreshTokenis stored — everclaude --print(headless/automation mode) immediately failsclaude --printworkers that die instantlyBusiness impact:
What we need (urgently):
--printmodeclaude auth refreshcommand for automationThis is not a feature request. This is a critical regression that makes Claude Code unusable for its advertised use case.
honzastim commentedon Mar 22, 2026
Third escalation — 7th forced re-login today, token lasted less than 5 minutes this time
Just did
/loginagain. Token expired before I could even finish reading the previous comment. This is now completely unusable.We are seriously considering canceling our Claude Code Max subscription. We've spent the entire day fighting this bug instead of doing actual work. Not a single task was completed successfully by our automation today because of this.
Please prioritize this. @anthropics/claude-code-team
honzastim commentedon Mar 22, 2026
Another OAuth expiry — 2026-03-22 ~20:45 UTC
Still happening consistently. This time the token expired mid-session while the agent was actively executing commands (last successful bash call returned 200 OK, then immediately got
401 authentication_error: "OAuth authentication is currently not supported").Timeline:
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}}/loginto restoreThis is the same pattern reported in the original issue — tokens expire every 10-15 minutes. This makes autonomous overnight operation impossible. We have trading bots and worker automation that depends on Claude Code sessions staying alive.
Impact: Blocks all Paperclip AI worker automation, overnight monitoring, and autonomous task execution.
Environment: Windows 11 Pro, Claude Code CLI, interactive mode (not just
--print).honzastim commentedon Mar 22, 2026
2x more OAuth expiry in 5 minutes — 2026-03-22 ~20:50-20:55 UTC
This is getting critical. Two more token expirations within a 5-minute window, each requiring manual
/login. The user is trying to set up overnight automation and cannot leave the terminal because tokens keep dying.Session timeline:
/loginrestore)/loginrestore)That's 3 forced logouts in 25 minutes of active usage. Each time the tool was mid-execution (writing files, making API calls) when it died.
This is a severe UX regression. The user literally cannot step away from the keyboard because the session dies every few minutes. Autonomous overnight workflows are completely blocked. This is not an edge case — it's core interactive usage breaking repeatedly.
Error:
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."}}Please prioritize this fix. Users running Claude Code for production automation are severely impacted.
honzastim commentedon Mar 22, 2026
4th OAuth expiry in ~30 minutes — 2026-03-22 ~21:00 UTC
This is now the FOURTH forced logout in a single 30-minute session. The token is expiring every 5-8 minutes now (getting worse, not better).
Timeline of this session alone:
The intervals are SHRINKING. First was 15 min, now it's consistently ~5 min. Each
/loginrestores a token that dies almost immediately.The user is unable to perform any meaningful work. Background processes cannot be monitored. Overnight automation is impossible. This is a P0 regression — the product is effectively non-functional for sessions longer than 5 minutes.
Credentials behavior: The credentials file gets wiped (all fields null) with no refresh_token being stored. This suggests the OAuth flow is issuing short-lived access tokens without refresh tokens.
Environment: Windows 11 Pro, Claude Code CLI latest, interactive mode.
cc @anthropics/claude-code-team — this needs urgent attention.
honzastim commentedon Mar 22, 2026
5th OAuth expiry — 2026-03-22 ~21:30 UTC
Token expired AGAIN. 5th time in ~60 minutes. User went to sleep and had to come back to re-login because token died while agent was doing overnight monitoring work.
This is completely unusable for any automation or even extended interactive sessions. Please fix urgently.
honzastim commentedon Mar 23, 2026
Morning update — 2026-03-23: Token expired overnight, zero autonomous work possible
As predicted, the OAuth token expired overnight. The user woke up to dead Claude Code sessions and had to manually
/logintwice just to start the morning.Overnight impact:
Session count since yesterday: 6+ forced
/loginre-authentications in ~10 hours. The token never survived more than 15 minutes.This is day 2 of this regression. Any ETA on a fix?
honzastim commentedon Mar 24, 2026
Update 2026-03-24 — Issue confirmed on v2.1.81, fix from #24317 does NOT resolve this
Environment: Windows 11 Pro, Claude Code v2.1.81, Max plan (20x tier), 3 concurrent claude.exe processes (1 interactive + 2
--printworkers spawned by Paperclip AI / Phoenix)What we observed today
Token is currently valid (8h lifetime, refresh token present). But the pattern from previous days continues:
--printusage.credentials.jsonfields become null/empty/loginfixes itRoot cause confirmed
This matches the deep source analysis by @LARIkoz in #24317:
proper-lockfilein v2.1.81 has only 5 retries with ~7.5s max wait — insufficient for 3+ concurrent processes.credentials.jsonis the only storage, making the race condition worseWhat we need (from a paying Max subscriber running production automation)
claude auth refreshCLI command for automation pre-warminggcloudauth)ANTHROPIC_API_KEYwithin subscription billing (not separate API billing)Our workaround attempts
CLAUDE_CODE_OAUTH_TOKENworkaround (blocked server-side since Feb 2026)tmuxisolation (Windows)/loginevery few hours, which defeats autonomous operationThis is a subscription-threatening blocker. We're paying $100/mo for Max specifically for automation, but the product requires manual intervention every few hours. Please prioritize.
cc @anthropics/claude-code-team
github-actions commentedon Apr 21, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Apr 30, 2026
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.