[BUG] Multiple Claude Code instances corrupt shared .claude.json config file on Windows

Resolved 💬 3 comments Opened Feb 26, 2026 by puNktumm Closed Feb 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Running two or more Claude Code instances simultaneously (e.g. in multiple VS Code windows or terminals) causes .claude.json to be corrupted with JSON Parse error: Unexpected EOF.
Steps to reproduce:

Open VS Code window 1, navigate to a project, run claude in the terminal
Open VS Code window 2, navigate to another project, run claude in the terminal
One or both instances will corrupt C:\Users\<user>\.claude.json

Expected behavior:
Multiple instances should either use file locking to prevent write conflicts, or each instance should handle concurrent writes gracefully.
Actual behavior:
Config file is repeatedly corrupted, requiring manual restore from backup. Claude Code becomes unusable until restored.
Environment:

OS: Windows 10 (19045.6466)
Claude Code version: 2.1.59
Editor: VS Code with integrated terminal

What Should Happen?

Multiple Claude Code instances should be able to run simultaneously without corrupting the shared config file. This could be achieved through file locking when writing to .claude.json, atomic writes (write to temp file, then rename), or by queuing concurrent writes. Users working across multiple projects in separate VS Code windows should not have to choose between productivity and stability.

Error Messages/Logs

Claude configuration file at C:\Users\hhame\.claude.json is corrupted: JSON Parse error: Unexpected EOF
The corrupted file has been backed up to: C:\Users\hhame\.claude\backups\.claude.json.corrupted.1772112743167
A backup file exists at: C:\Users\hhame\.claude\backups\.claude.json.backup.1772112686176
You can manually restore it by running: cp "C:\Users\hhame\.claude\backups\.claude.json.backup.1772112686176" "C:\Users\hhame\.claude.json"
This error appears repeatedly and rapidly when two Claude Code instances are running simultaneously. The file gets corrupted, auto-backed-up, and then corrupted again in a loop until Claude Code crashes.

Steps to Reproduce

Open VS Code window 1, navigate to any project folder
Open the integrated terminal and run claude
Open a second VS Code window, navigate to a different project folder
Open the integrated terminal in window 2 and run claude
Interact with Claude in either terminal (or simply wait)
Observe that .claude.json gets corrupted almost immediately with JSON Parse error: Unexpected EOF
Claude Code crashes or becomes unresponsive
Running the restore command fixes it temporarily, but the corruption repeats if both instances remain open

Note: The issue also occurs when opening two terminals within the same VS Code window and running claude in both simultaneously.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.59 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

The root cause appears to be that all Claude Code instances share a single config file at C:\Users\<user>\.claude.json with no file locking or atomic write mechanism. When two instances try to write to the file at the same time, one truncates it mid-write, resulting in invalid JSON.
The corruption happens very fast — sometimes within seconds of launching the second instance. Claude Code does automatically back up the corrupted file, which is helpful, but the restore process is manual and the corruption repeats immediately if both instances stay open.
A simple fix would be atomic writes: write to a temp file first, then rename/move it to replace .claude.json. On Windows, this is an atomic operation at the OS level and would prevent mid-write corruption entirely.
This is a significant usability issue for developers who work across multiple projects simultaneously, which is a very common workflow.
OS: Windows 10 (19045.6466)
Claude Code version: 2.1.59
Shell: Windows Command Prompt / VS Code integrated terminal

View original on GitHub ↗

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