[BUG] SessionStart hooks break input after execution on Windows
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When I set up a SessionStart hook, the input field breaks after it runs. The text ^[[I briefly appears underneath the input field after the hook executes, and then all subsequent input continues in that space underneath the input field. Other terminal inputs produce other control codes (^[[O when unfocusing etc.). I do not have any issues with hooks on MacOS, only on Windows.
<img width="812" height="101" alt="Image" src="https://github.com/user-attachments/assets/311b6670-2713-4d70-bf62-f4dc595ab45b" />
After typing \, the input field seems to fix itself.
What Should Happen?
The input field should not break after the hook runs.
Error Messages/Logs
Steps to Reproduce
- Create a config file at
.claude/settings.local.jsonwith the following content:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "echo OK"
}
]
}
]
}
}
- Run Claude Code (
claude) - Observe the text
^[[Iprint briefly underneath the input, and then the input field breaks, as noted above.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.30
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
This happens in both Powershell and Git Bash. This also occurs with SessionStart hooks from plugins (I was only attempting to use hooks to replace my deprecated output styles).
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗