File Lock Conflict: Unable to Create Snapshot Lock File
Bug Description When you launch a second instance of claude, get the following error and claude crashs
: [Error: ENOENT: no such file or directory, stat '/home/joshua/.claude/shell-snapshots/snapshot-bash-1752669055543-4cb4d5.sh.lock'] { errno: -2, code: 'ECOMPROMISED', syscall: 'stat', path: '/home/joshua/.claude/shell-snapshots/snapshot-bash-1752669055543-4cb4d5.sh.lock' }
Environment Info
- Platform: linux
- Terminal: cursor
- Version: 1.0.53
- Feedback ID: 72e9051e-b455-4d95-9fe9-65defc6250f2
Errors
[{"error":"Error: 1: 1 [59775:0716/231815.220528:ERROR:ozone_platform_x11.cc(246)] Missing X server or $DISPLAY\n[59775:0716/231815.220576:ERROR:env.cc(257)] The platform failed to initialize. Exiting.\n\n at Lq6 (file:///home/joshua/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1208:5219)\n at async qq6 (file:///home/joshua/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1208:2582)","timestamp":"2025-07-16T13:18:16.937Z"}]
Same issue here is the results of diagnosing and troubleshooting with Claude:
Shell Snapshot Corruption Bug - Multiple Session Cascade Failure
Environment
- Claude Code Version: 1.0.53
- Runtime: Bun v1.2.15 (Linux x64 baseline)
- OS: Ubuntu 24.04.2 LTS
- Affected: Both CLI and VS Code extension
Bug Description
Claude Code crashes with ECOMPROMISED error when multiple sessions are active, causing cascading failures across all sessions.
Error Pattern
error: ENOENT: no such file or directory, stat '/home/user/.claude/shell-snapshots/snapshot-bash-{timestamp}-{id}.sh.lock' path: "/home/user/.claude/shell-snapshots/snapshot-bash-{timestamp}-{id}.sh.lock", syscall: "stat", errno: -2, code: "ECOMPROMISED"
Root Cause Analysis
- Lock files created as directories: Shell snapshot system creates lock directories instead of lock files
- Race condition: Multiple sessions compete for same lock resources in shared directory
- Cascading failure: When one session crashes, corrupted lock state causes all other sessions to crash
- No concurrency control: System appears designed for single-session use
Reproduction Steps
- Open multiple Claude sessions (CLI and/or VS Code extension)
- Run any commands in the sessions
- Eventually one session crashes with shell snapshot error
- All other active sessions crash shortly after
Impact
- Cannot maintain stable sessions: Sessions crash after single commands
- Impossible to do meaningful work: Development workflow completely disrupted
- System-wide failure: Affects all Claude Code interfaces simultaneously
- Unpredictable timing: Can crash immediately or after several commands
Expected Behavior
Multiple Claude sessions should be able to run concurrently without interfering with each other's shell snapshot management.
Workaround
None found. Restarting temporarily clears corrupted lock state but issue recurs.
Files/Directories Affected
/home/user/.claude/shell-snapshots/- Lock files created as directories/home/user/.claude/projects/- Session files (appear stable)
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.