claude.exe crashes with STATUS_STACK_BUFFER_OVERRUN (0xc0000409) after long-idle session, corrupts terminal mouse-tracking state
Description
After a Claude Code session has been open for a while, claude.exe crashes/exits. When it crashes, it leaves the host terminal in xterm mouse-tracking mode (SGR mouse mode), so every subsequent mouse movement injects raw escape sequences (e.g. 9;5uu35;8;1M35;8;2M...) into the shell as literal keystrokes, and keyboard shortcuts also stop being interpreted correctly by the shell. Only reset (or closing the terminal) restores normal terminal behavior.
Crash details from Windows Event Viewer (Application log, Event ID 1000)
Observed 3 times, all with the identical fault offset, suggesting a deterministic/reproducible bug rather than random memory corruption:
Faulting application name: claude.exe, version: 2.1.220.0, time stamp: 0x6a586164
Faulting module name: claude.exe, version: 2.1.220.0, time stamp: 0x6a586164
Exception code: 0xc0000409 (STATUS_STACK_BUFFER_OVERRUN / fast-fail)
Fault offset: 0x000000000373fbf9
Faulting application path: C:\Users\<user>\AppData\Roaming\npm\node_modules\@anthropic-ai\claude-code\bin\claude.exe
All three crashes hit the exact same fault offset (0x373fbf9), across separate sessions/days.
Environment
- OS: Windows 11 Enterprise 10.0.26100
- Install method: npm (
@anthropic-ai/claude-code), was on 2.1.220 when crashes occurred, since updated to 2.1.221 - Shell: Git Bash / PowerShell terminal (not WSL)
- Terminal: Windows terminal emulator (not yet confirmed if Windows Terminal or ConHost)
Steps to reproduce
- Open a Claude Code session in a terminal on Windows.
- Leave it open/idle for an extended period.
claude.execrashes on its own (no explicit user action observed at crash time).- Move the mouse in the now-dead terminal — mouse-tracking escape sequences get typed into the shell as literal text, and normal keyboard shortcuts stop working until
resetis run or the terminal is closed.
Expected behavior
claude.exeshould not crash from an idle state.- Regardless of crash cause, Claude Code should disable terminal mouse-tracking / restore terminal modes on exit (including abnormal exit), e.g. via a signal handler / atexit hook, so a crash doesn't leave the host terminal in a broken state.
Additional notes
Will update this issue if the crash recurs on 2.1.221 with a new fault offset (which would indicate a different/regressed issue rather than the same one).