.claude.json repeatedly corrupted when running multiple instances on Windows

Resolved 💬 5 comments Opened Feb 26, 2026 by hokiepokedad2 Closed Feb 26, 2026

Description

When running multiple Claude Code instances simultaneously (e.g., multiple VS Code windows each with Claude Code in the integrated terminal), the shared ~/.claude.json config file is repeatedly detected as corrupted with JSON Parse error: Unexpected EOF. The file gets replaced with a minimal fresh config, and the cycle repeats endlessly.

Environment

  • OS: Windows 10 Pro 10.0.19045
  • Claude Code version: 2.1.59
  • Install method: Native
  • Shell: bash (Git Bash)

Steps to Reproduce

  1. Open two or more VS Code windows
  2. Run Claude Code in the integrated terminal of each
  3. Use both instances actively
  4. .claude.json corruption errors start appearing repeatedly

Observed Behavior

  • Error: C:\Users\<user>\.claude.json is corrupted: JSON Parse error: Unexpected EOF
  • The "corrupted" backups saved to ~/.claude/backups/ are actually valid JSON — they are the real config (~43KB, 454 startups, 52 keys)
  • Claude Code replaces the real config with a minimal fresh one (~1-6KB, numStartups reset to 4)
  • This triggers a loop where the new minimal config also gets flagged, generating dozens of backup files (~80 in one session)
  • All usage history, tool counts, and accumulated settings are lost on each reset

Expected Behavior

Multiple Claude Code instances should be able to coexist without corrupting shared config. The file write to .claude.json should use atomic writes (write to temp file, then rename()/fs.rename()) and/or file locking to prevent race conditions.

Root Cause Analysis

Two instances reading/writing .claude.json simultaneously without atomic writes or file locking. Instance B reads mid-write by Instance A, sees partial content, declares it corrupted, and overwrites it with a fresh config. Instance A then sees the reset file, declares it corrupted, and the cycle continues.

Windows Defender real-time scanning (MsMpEng) and Windows Search Indexer may exacerbate the issue by adding additional file reads during writes.

Workaround

Only running a single Claude Code instance at a time prevents the issue, but this is a significant workflow limitation.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗