.claude.json corrupted repeatedly during concurrent sessions (v2.1.59, Windows 11)
Description
Running 2+ concurrent Claude Code sessions causes .claude.json to become corrupted with JSON Parse error: Unexpected EOF. The issue started around 2300 hrs IST on Feb 26, 2026 and has recurred multiple times since. Each time the session terminates and on restart Claude Code acts as if it's a first-time setup (re-auth, theme selection, etc).
I've been a Claude Code user since public launch (~Jul 2025) and run concurrent sessions regularly (3-4 at a time). This issue never occurred before Feb 26, 2026.
Scale of the problem
We have deleted approximately 30 corrupted files from the backups folder since this started:
- When the initial corruption started (~2300 IST, Feb 26), we closed all VS Code and Claude Code sessions and found ~23 corrupted files (most were 1KB — truncated mid-write). Deleted those, kept the larger ones for reference.
- Started 2 Claude Code sessions again, and it happened again — producing another ~6 corrupted files which we also deleted.
- The corrupted files currently remaining in the backups folder are just what's left after cleanup. While some show older dates (Feb 22, 25), the actual user-facing issue only started on Feb 26 night.
Error message
Claude configuration file at C:\Users\<user>\.claude.json is corrupted: JSON Parse error: Unexpected EOF
The corrupted file has been backed up to: C:\Users\<user>\.claude\backups\.claude.json.corrupted.<timestamp>
A backup file exists at: C:\Users\<user>\.claude\backups\.claude.json.backup.<timestamp>
Evidence — remaining backup files
.claude.json.corrupted.<ts> (Feb 22, 59KB)
.claude.json.corrupted.<ts> (Feb 25, 63KB)
.claude.json.corrupted.<ts> (Feb 26, 67KB)
.claude.json.corrupted.<ts> (Feb 27, 13KB — truncated, likely mid-write)
.claude.json.backup.<ts> (Feb 27, 7KB — healthy backup)
The 1KB corrupted files (deleted) suggest writes interrupted almost immediately. The varying sizes (1KB to 67KB) indicate corruption can happen at any point during a write.
Environment
- Claude Code: v2.1.59
- OS: Windows 11 Home 10.0.26200
- Shell: Git Bash
- Concurrent sessions: 2-4 Claude Code instances on different projects
Steps to reproduce
- Open 2+ Claude Code sessions in different terminal windows on different projects
- Work actively in both sessions (tool calls, file reads/writes)
- After some time (varies — minutes to hours), one session outputs the corruption error and terminates
- Restarting Claude Code triggers the first-time setup flow (auth, theme selection)
Likely root cause
Race condition — multiple sessions reading/writing the shared ~/.claude.json file without file locking or atomic writes. The 1KB truncated files and the 13KB partial file strongly suggest concurrent writes stomping on each other.
Suggested fix
Use atomic writes (write to temp file in same directory, then rename()) or advisory file locking when updating .claude.json. The rename approach is simplest and works cross-platform.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗