Skip to content

Race condition: .claude.json corruption when running multiple instances concurrently #28847

@HardRockTech

Description

@HardRockTech

Description

Running multiple Claude Code instances simultaneously causes repeated .claude.json corruption due to concurrent writes without file locking or atomic write operations.

Environment

  • Claude Code version: 2.1.59 (also observed on earlier versions back to at least ~2.1.56)
  • OS: Windows 11 Pro 10.0.26200
  • Shell: Windows Powershell

Steps to Reproduce

  1. Open 5+ terminal windows
  2. Run claude in each
  3. Use them concurrently for normal work
  4. Observe repeated corruption warnings on startup and during sessions

Observed Behavior

Each instance detects the corruption, backs up the broken file, and recovers — but this produces:

  • Hundreds of .claude.json.corrupted.* backup files in ~/.claude/backups/ (305 files accumulated in a single day)
  • Spam warning messages on every startup:
    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>
    
  • The corrupted files show truncated JSON (partial writes caught mid-stream)

Expected Behavior

Multiple concurrent instances should be able to coexist without corrupting the shared config file. No warning spam, no backup file accumulation.

Suggested Fix

Redacted by Claude Code maintainers to avoid confusion as users find this issue.

Impact

  • Not data-losing — Claude Code recovers gracefully each time
  • Annoying — constant warning messages disrupt workflow
  • Disk clutter — hundreds of small backup files accumulate rapidly
  • Legitimate workflow — running multiple instances in parallel (e.g., one per project/repo) is a common power-user pattern that should be supported
Pinned by stevenpetryk

Metadata

Metadata

Assignees

Labels

area:corebugSomething isn't workinghas reproHas detailed reproduction steps

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions