[BUG] Critical regression: .claude.json corruption from concurrent sessions - unacceptable for production use
Environment
- Claude Code version: 2.1.59
- OS: Windows 10/11 (MSYS_NT-10.0-26100)
- Concurrent sessions: 11 (normal for methodology-driven multi-agent workflows)
Problem
.claude.json is being corrupted repeatedly due to non-atomic writes from concurrent sessions. This is a critical regression that makes Claude Code unreliable for any serious multi-session workflow.
Claude configuration file at C:\Users\RBatt\.claude.json is corrupted: JSON Parse error: Unexpected EOF
The corrupted file has been backed up to: C:\Users\RBatt\.claude.json.corrupted.1772075903627
This happened twice within minutes during normal operation.
Root Cause
All Claude sessions share a single global config file:
~/.claude.jsoncontainstoolUsage,clientDataCache,projects, etc.- These fields are written frequently (every tool call updates
toolUsage) - With N concurrent sessions, you have N processes doing read-modify-write without file locking
- Result: truncated JSON, corrupted config, interrupted workflows
Evidence
$ tasklist | grep claude
claude.exe 23592 730 MB
claude.exe 10004 359 MB
claude.exe 38728 218 MB
... (11 total processes)
All 11 fighting over one file. This is Computer Science 101 - concurrent writes need locking.
Impact
- Workflow interruption: Session stops, user must manually restore backup
- Data loss risk: If backup is also corrupted, project-specific settings lost
- Trust erosion: Users running production agent workflows cannot rely on Claude Code
Expected Behavior
Concurrent Claude Code sessions should:
- Use atomic writes (write to temp file, rename)
- Use file locking (flock/LockFileEx)
- Or separate per-session state from shared config
This Is a Regression
This did not happen in earlier versions. Users have been running 10+ concurrent sessions without issue. Something in recent versions (2.1.x) broke the concurrency model.
Duplicates
I see #28824, #28813, #28809 filed today for the same issue. The volume of reports should indicate severity. This needs a hotfix, not a backlog ticket.
---
Respectfully: shipping a CLI tool that corrupts its own config file when users run multiple instances is not acceptable. Multi-session usage is a core workflow for agent-based development. Please prioritize this fix.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗