[BUG] Claude Code crashes on Windows when debug directory is missing (ENOENT in appendFileSync)

Status Closed — not planned
Reported on v2.1.50
Maintainer reply None cached
Activity 2 comments · opened Feb 22, 2026 · closed Mar 22, 2026

What's Wrong?
Claude Code exits unexpectedly when it encounters an ENOENT error while trying to write to the debug directory. The ~/.claude/debug/ directory is missing, causing appendFileSync to throw and crash the entire process instead of handling the error gracefully and continuing.

Error message:

ERROR  ENOENT: no such file or directory, open '\?\C:\Users\Tony\.claude\debug\4afdf964-b07d-4695-b1a2-710eae7c6b9a.txt'
 - at appendFileSync (unknown)
 - appendFileSync (B:/~BUN/root/claude.exe:12:1854)
 - writeFn (B:/~BUN/root/claude.exe:12:4949)
 - E (B:/~BUN/root/claude.exe:12:4332)
 - write (B:/~BUN/root/claude.exe:12:4455)
 - q (B:/~BUN/root/claude.exe:14:36)
 - QlA (B:/~BUN/root/claude.exe:11250:42544)
 - GD (B:/~BUN/root/claude.exe:241:20801)
 - tW (B:/~BUN/root/claude.exe:241:39202)
 - Zl (B:/~BUN/root/claude.exe:241:49826)

What Should Happen?
When the debug directory is missing or a debug file cannot be written, Claude Code should log a warning and continue normal operation without crashing. Debug logging is a non-critical operation and should never terminate the process.

Steps to Reproduce

  1. Ensure ~/.claude/debug/ directory does not exist on Windows
  2. Run Claude Code and trigger any operation that writes debug logs
  3. Observe Claude Code exits completely instead of continuing

Environment

  • Claude Code version: 2.1.50
  • OS: Windows 10 Pro (Build 19045)
  • Terminal: Windows Terminal 1.23.20211.0
  • Platform: Claude Max (Max 5)

View original on GitHub ↗

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