Background daemon forces full re-auth after PC shutdown instead of retrying token refresh

Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 8, 2026

Every time I shut down my PC, I have to fully re-authenticate Claude Code on next launch, even though my refresh token is still valid for weeks.

Environment: Linux (CachyOS, Arch-based), Claude Code daemon v2.1.243

Relevant log excerpt from ~/.claude/daemon.log:

[supervisor] ─── daemon start ─── version=2.1.243 pid=991751 origin=transient
[supervisor] auth: scheduling proactive refresh in 27775s
[supervisor] workers=0
...
[supervisor] auth: proactive refresh starting
[supervisor] auth: proactive refresh failed, signalling re-auth required
[supervisor] auth: headless daemon cannot complete OAuth — run `claude auth login` to refresh
[supervisor] auth: no token found, will re-check keychain every 30s

What I think is happening:

  • The background daemon is spawned per-session (origin=transient) and gets killed on shutdown/logout, well before its scheduled proactive refresh timer (~7-8 hours out) ever fires.
  • On next boot, the daemon starts fresh and finds the previous access token expired.
  • It attempts to refresh, but when that attempt fails, it immediately escalates to demanding a full interactive claude auth login instead of retrying the refresh_token grant.

At the time this happened, .credentials.json still contained a refreshToken with refreshTokenExpiresAt weeks in the future — so the refresh token itself should still have been valid. This suggests the refresh call is failing for a different reason (e.g. network not yet up right after boot, or some other transient error) and the daemon isn't retrying before giving up and forcing a full re-login.

Expected behavior: A single failed proactive/on-demand refresh attempt (especially right after boot, when network may not be ready yet) shouldn't immediately force a full interactive re-auth. It would help to retry the refresh_token grant a few times with backoff before falling back to requiring claude auth login.

Actual behavior: Any time my PC is shut down across the daemon's refresh window, I'm forced to fully re-authenticate on next launch.

View original on GitHub ↗