[BUG] [Windows 11] All hooks fail silently - SessionStart, PreCompact, UserPromptSubmit never execute
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?
Hooks configured in ~/.claude/settings.json do not execute on Windows 11. All hook types fail silently - SessionStart, PreCompact, and UserPromptSubmit. No error messages are displayed. The /hooks menu shows hooks are configured ("2 hooks"), but they never run.
Scripts execute correctly when run manually from the terminal, confirming they work. The issue is that Claude Code never triggers them.
What Should Happen?
When Claude Code starts a new session, the SessionStart hook should execute and its stdout should be shown to Claude (as documented). Similarly, UserPromptSubmit hooks should trigger when the user submits a prompt, and PreCompact hooks should trigger before context compaction.
Error Messages/Logs
No error messages. Complete silent failure. No output in terminal, no warnings, nothing
Steps to Reproduce
- Create test script: C:\Users\username\.claude\hooks\test.bat
Content: @echo off && echo HOOK_TEST_WORKS
- Verify script works manually:
> C:\Users\username\.claude\hooks\test.bat
HOOK_TEST_WORKS
- Add to ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{"type": "command", "command": "echo SIMPLE_TEST"}
]
}
]
}
}
- Close ALL Claude Code windows completely
- Restart Claude Code
- Type any message
- Expected: "SIMPLE_TEST" appears in context
Actual: Nothing. Claude confirms no hook output received.
Tested configurations:
- SessionStart with matcher "startup" and "resume"
- PreCompact with matcher "auto" and "manual"
- UserPromptSubmit without matcher
- .bat wrapper files
- Direct echo commands
- Python scripts
- Absolute paths with escaped backslashes
ALL fail silently.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.0.70
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Spent several hours debugging with Claude Code itself. Tried every documented configuration format from https://code.claude.com/docs/en/hooks including:
- Configuration via manual settings.json edit
- Configuration via /hooks interactive menu
- With and without matchers
- Absolute paths with escaped backslashes (C:\\Users\\...)
- .bat wrapper files calling Python scripts
- Direct Python calls with full path
- Simple echo commands
The hooks system appears completely non-functional on Windows 11. The /hooks menu recognizes the configuration but hooks never execute.
Related issues: #12874, #13203
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗