Re-authentication required after every clean restart due to auto-update wiping credentials
Bug Description
After closing Claude Code cleanly and restarting it, the full first-time authorization flow is triggered (OAuth login required), as if it were a fresh installation. This happens consistently — not just once.
Environment
- OS: Linux (CachyOS), kernel 7.x
- Shell: zsh
- Claude Code version: 2.1.170 (observed during: 2.1.159 → 2.1.161 auto-update)
- Install path:
/opt/claude-code/bin/claude
Steps to Reproduce
- Use Claude Code normally in a session
- Close Claude Code cleanly (normal exit)
- Start Claude Code again
- Full first-time authorization flow appears (OAuth re-login required)
Expected Behavior
Existing credentials should persist. The refresh token should silently renew the access token if expired — no user interaction required.
Root Cause (from daemon log)
binary at /opt/claude-code/bin/claude changed (mtime changed)
— self-restarting for upgrade
daemon start — version=2.1.159 → 2.1.161 (origin=transient)
The supervisor daemon self-restarts on binary mtime changes (auto-update). After restart, credentials are lost or invalidated.
Additionally, two concurrent config formats exist on disk simultaneously:
~/.claude.json— legacy all-in-one JSON (still being written to)~/.claude/directory — newer split format
This dual-format situation suggests an incomplete migration. The auto-update likely resets ~/.claude.json or breaks the mapping between formats, causing Claude Code to treat the next startup as first-time setup.
Frequency
Reproducible reliably on multiple consecutive days after clean restarts.
Impact
Every restart requires full OAuth re-authorization and plugin reconfiguration — blocks daily development workflow.
Fix Requested
- Auto-updates must not clear persisted credentials
- Migration from
~/.claude.json→~/.claude/must be idempotent - If re-auth is genuinely required (new scopes etc.), show a clear explanation instead of silently triggering first-time-setup
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗