Claude Code bug: a root run makes your config unreadable, then silently wipes it
scscgit · ghdev · 2026-11-17
A confirmed data-loss bug (has repro) in anthropics/claude-code: running Claude Code as root on a user-owned config dir (sudo -E claude, or docker exec shells) rewrites .claude.json and creates root-owned sessions/, backups/, etc. The owner can no longer read their config; Claude Code then treats it as missing, runs first-run onboarding, and replaces it with a near-empty file within a second.
- All workspace trust, allowedTools, MCP approvals, settings and flags are lost
- No recoverable copy: the backup lives in root's backups/ with mode 600
- Not root-specific: any unreadable config (files restored by another user, UID changes after container rebuilds) hits the same path
The reporter asks that an EACCES config never be replaced without a readable copy (like the existing .corrupted behavior, issue #106634), and that ownership be preserved regardless of who runs the tool.
More from coding & agent
- Chinese devs vent: app store rejections and copycats are just the norm — tinyfool · 2026-11-22
- Compacting Early and Often Boosts Agent Accuracy While Cutting Cost and Runtime — zainhas · 2026-11-22
- Astra 6.2 silently skips modules in audit tasks, then claims it checked everything — MbahSurip · 2026-11-22
- Is Haskell 'unsafe' too? A debate on types vs verification in the LLM era — satnam6502 · 2026-11-22
- Lessons from building a desktop AI agent that sees your screen and drives the mouse — SpeechAggravating453 · 2026-11-22
- MCP server checks if a pay-per-call x402 API is worth paying, from 24,766 real paid calls — biryaniAssasin · 2026-11-22