SessionStart command hooks freeze terminal input on Windows
Bug Description
Any SessionStart command hook causes an indefinite terminal input freeze on Windows. The terminal becomes completely unresponsive to keyboard input. The only workaround is to paste from the clipboard, which "unsticks" the input buffer.
This affects all SessionStart command hooks — even the most trivial:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "echo hello",
"timeout": 2
}
]
}
]
}
}
Steps to Reproduce
- On Windows, add any
SessionStartcommand hook to~/.claude/settings.json - Launch
claudein Windows Terminal or PowerShell - Wait for the prompt to appear
- Try to type — keyboard input is completely frozen
- Copy any text to clipboard and paste into terminal — input becomes unstuck
Expected Behavior
Terminal input should work normally after SessionStart hooks complete.
Actual Behavior
Terminal input is indefinitely frozen. No timeout resolves it. Only a clipboard paste operation (which uses a different Windows input code path) unfreezes it.
Environment
- OS: Windows 11 (build 26200.7623)
- Terminals tested: Windows Terminal, PowerShell (both affected)
- Claude Code version: 2.1.33
- Node.js: installed via npm global
Debugging Notes
Through systematic binary-search testing:
- All other hook types work fine:
PreToolUse,PostToolUse,UserPromptSubmit,PreCompact— none cause the freeze - Only
SessionStarthooks trigger the bug — evenecho hellowith a 2s timeout - Not related to the hook script content — the issue is in how Claude Code spawns the child process during session initialization
- Likely cause: The child process spawned for SessionStart hooks interferes with the Windows ConPTY stdin handling. On Windows, spawning a process during terminal initialization can corrupt the console input buffer state. Other hook types fire later (after the terminal is fully initialized) and don't have this issue.
Workaround
Remove all SessionStart command hooks. Move any startup logic to UserPromptSubmit hooks instead (which fire on first user input and work correctly).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗