[BUG] Config file corruption when multiple Claude Code processes run concurrently
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?
Description
The ~/.claude.json config file becomes corrupted when multiple Claude Code CLI processes access it simultaneously. This occurs in multi-process scenarios such as:
Multiple VS Code windows with Claude Code extension
A desktop application invoking claude CLI while VS Code is running
Batch processing that spawns parallel claude CLI invocations
What Should Happen?
Expected Behavior
Multiple Claude Code processes should be able to run concurrently without corrupting the shared config file.
Error Messages/Logs
Error Messages
Config file corrupted, resetting to defaults: JSON Parse error: Unexpected EOF
Corrupted config backed up to: C:\Users\<user>\.claude.json.corrupted.<timestamp>
SyntaxError: Unexpected token 'C', "Claude con"... is not valid JSON
Steps to Reproduce
Steps to Reproduce
Open VS Code with Claude Code extension in Project A
Open a second VS Code window with Claude Code extension in Project B
Perform any action that triggers Claude Code in either window
Config corruption occurs intermittently
Alternative reproduction (programmatic):
// Spawn multiple claude CLI processes in parallel
var tasks = Enumerable.Range(0, 6).Select(_ => Task.Run(async () =>
{
var process = Process.Start(new ProcessStartInfo
{
FileName = "claude",
Arguments = "--print --output-format json",
RedirectStandardInput = true,
// ...
});
// Send prompt and await response
}));
await Task.WhenAll(tasks);
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.25 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Suggested Fixes
Atomic file writes - Write to temp file, then rename (atomic on most filesystems)
File locking - Use OS-level file locks when reading/writing config
Per-process/session config - Support --config <path> flag or environment variable to isolate config per process
Retry with backoff - If config read fails, retry after brief delay
Environment
OS: Windows 11
Claude Code Version: (latest as of Dec 2025)
Scenario: WPF desktop app invoking claude --print --output-format json + VS Code extension
Workaround
Currently using an in-process semaphore to serialize CLI invocations within our application, but this doesn't prevent conflicts with VS Code or other external processes:
private static readonly SemaphoreSlim _cliSemaphore = new(1, 1);
await _cliSemaphore.WaitAsync(cancellationToken);
try { / execute claude CLI / }
finally { _cliSemaphore.Release(); }
Impact
Data loss: Config resets to defaults, losing user preferences
Workflow disruption: Must close and reopen VS Code to recover
Batch processing reliability: Long-running batch jobs fail intermittently
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗