Description
Running multiple Claude Code instances simultaneously on the same Windows machine causes repeated .claude.json corruption due to write race conditions.
Environment
- Claude Code v2.1.59
- Windows 11 (10.0.26100)
- Two concurrent instances in different repos/workspaces on the same machine
Steps to Reproduce
- Open two Claude Code sessions on the same machine (different repos)
- Use both actively (both writing to
~/.claude.json for internal state)
- Within minutes, one or both sessions report:
Claude configuration file at C:\Users\<user>\.claude.json is corrupted: JSON Parse error: Unexpected EOF
Observed Behavior
- 16 corruptions in approximately 1 hour of dual-instance usage
- Auto-recovery system correctly detects corruption, backs up the bad file, and restores from last good backup
- Both sessions continue functioning after recovery
- The
cachedGrowthBookFeatures object in .claude.json is the primary area of conflict — it gets truncated mid-write
Impact
- Feature flag cache loss: Restored backup contains stale feature flags. Remote Control (
claude remote-control) stops working because the restored cachedGrowthBookFeatures predates the feature gate being enabled for the account.
- Noise: Repeated error messages disrupt workflow
- State loss: Any
.claude.json state written between the last backup and the corruption is lost
Expected Behavior
Concurrent Claude Code instances should safely share ~/.claude.json without corruption. Possible fixes:
- Atomic writes (write to temp file, then rename — rename is atomic on most filesystems)
- Per-instance state files (each instance gets its own cache file)
- File locking
Evidence
Backup directory shows the pattern clearly:
# 16 corrupted files in ~1 hour, sizes vary (157 bytes to 18KB = truncation)
.claude.json.corrupted.1772099857550 (18243 bytes)
.claude.json.corrupted.1772099904936 (2565 bytes)
.claude.json.corrupted.1772101307584 (8710 bytes)
.claude.json.corrupted.1772101699755 (9348 bytes)
.claude.json.corrupted.1772101751603 (9427 bytes)
.claude.json.corrupted.1772101751657 (9427 bytes)
.claude.json.corrupted.1772101805772 (11686 bytes)
.claude.json.corrupted.1772101811912 (11686 bytes)
.claude.json.corrupted.1772101930972 (5769 bytes)
.claude.json.corrupted.1772102754102 (7564 bytes)
.claude.json.corrupted.1772102754200 (157 bytes)
.claude.json.corrupted.1772102760103 (2645 bytes)
Use Case
Multi-agent development workflows where multiple Claude Code instances operate on different projects simultaneously. This is a growing use case with Agent Teams support.
Description
Running multiple Claude Code instances simultaneously on the same Windows machine causes repeated
.claude.jsoncorruption due to write race conditions.Environment
Steps to Reproduce
~/.claude.jsonfor internal state)Claude configuration file at C:\Users\<user>\.claude.json is corrupted: JSON Parse error: Unexpected EOFObserved Behavior
cachedGrowthBookFeaturesobject in.claude.jsonis the primary area of conflict — it gets truncated mid-writeImpact
claude remote-control) stops working because the restoredcachedGrowthBookFeaturespredates the feature gate being enabled for the account..claude.jsonstate written between the last backup and the corruption is lostExpected Behavior
Concurrent Claude Code instances should safely share
~/.claude.jsonwithout corruption. Possible fixes:Evidence
Backup directory shows the pattern clearly:
Use Case
Multi-agent development workflows where multiple Claude Code instances operate on different projects simultaneously. This is a growing use case with Agent Teams support.