Windows: Stale IDE lock files in ~/.claude/ide/ cause extension to hang after VS Code crash/restart

Resolved 💬 3 comments Opened Mar 8, 2026 by ChimeraWerks Closed Mar 12, 2026

Summary

When VS Code exits uncleanly (crash, force-quit, or closing while CCE is mid-task), the .lock files in ~/.claude/ide/ are never cleaned up. On the next VS Code session, the extension creates new lock files but the stale ones persist, accumulating over time. This causes the extension to hang/become unresponsive — likely attempting to communicate with dead websocket endpoints that no longer exist.

Reproduction

  1. Open VS Code with multiple Claude Code extension panels
  2. Close VS Code (or let it crash) while CCE panels are active
  3. Reopen VS Code and open CCE panels again
  4. Repeat a few times

Observe ~/.claude/ide/ — lock files accumulate with each session. All old ones reference a dead PID:

$ ls ~/.claude/ide/
16335.lock  23517.lock  36544.lock  39468.lock  47769.lock  54505.lock  65416.lock
19084.lock  24294.lock  36951.lock  40325.lock  52517.lock  63239.lock  63945.lock
38757.lock  44208.lock

Every lock file referenced a single PID that was long dead:

{"pid":12345,"workspaceFolders":["c:\projects\myproject"],"ideName":"Visual Studio Code","transport":"ws","runningInWindows":true,"authToken":"<redacted>"}

Impact

  • Extension panels freeze/hang with no visible error
  • Only 1 of 4 claude.exe processes was actually alive; the rest had died silently
  • Manually deleting the stale lock files and restarting immediately resolved the issue

Workaround

rm ~/.claude/ide/*.lock
# Then restart VS Code

Suggested Fix

On startup, the extension should:

  1. Enumerate existing .lock files in ~/.claude/ide/
  2. Check if the PID in each lock file is still alive
  3. Delete any lock files referencing dead processes

Alternatively, use a heartbeat/TTL mechanism instead of static lock files.

Environment

  • OS: Windows 10
  • VS Code: Latest
  • Claude Code Extension: Latest
  • Setup: Single VS Code window with 3 CCE panels open to different workspace folders

Related Issues

  • #30417 — Extension hangs, lock file race condition
  • #29413 — /clear leaks processes on Windows
  • #18405 — Orphaned subagent processes on Windows
  • #28546 — Stale .git/index.lock on Windows (same pattern, different file)

View original on GitHub ↗

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