[BUG] Race condition when multiple VS Code windows write to ~/.claude.json simultaneously

Resolved 💬 3 comments Opened Jan 24, 2026 by nkocher Closed Jan 29, 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?

When running Claude Code in multiple VS Code windows with different projects, multiple processes attempt to write to ~/.claude.json simultaneously, causing lock failures that don't prevent writes.

Lock fails but write proceeds anyway, causing race condition:
[ERROR] Failed to save config with lock: Error: Lock file is already being held
[DEBUG] File /Users/.../.claude.json written atomically ← write happens anyway

What Should Happen?

Lock acquisition failure should prevent the write and retry/queue, or config should be per-workspace.

Error Messages/Logs

2026-01-24T18:34:51.941Z [ERROR] Failed to save config with lock: Error: Lock file is already being held
2026-01-24T18:34:51.941Z [DEBUG] File /Users/nicholaskocher/.claude.json written atomically

Steps to Reproduce

  1. Open VS Code window A with project A, Claude Code active
  2. Open VS Code window B with project B, Claude Code active
  3. Use Claude Code in both windows (or trigger any config-writing action)

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.19 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Multiple PIDs (34772, 34785) racing, file size changing rapidly (746 → 790 → 835 → 892 → 922 → 1214 bytes) as both overwrite each other.

View original on GitHub ↗

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