[BUG] [Windows 11] All hooks fail silently - SessionStart, PreCompact, UserPromptSubmit never execute

Resolved 💬 4 comments Opened Dec 16, 2025 by Sysbaia Closed Dec 20, 2025

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

  1. Create test script: C:\Users\username\.claude\hooks\test.bat

Content: @echo off && echo HOOK_TEST_WORKS

  1. Verify script works manually:

> C:\Users\username\.claude\hooks\test.bat
HOOK_TEST_WORKS

  1. Add to ~/.claude/settings.json:

{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{"type": "command", "command": "echo SIMPLE_TEST"}
]
}
]
}
}

  1. Close ALL Claude Code windows completely
  1. Restart Claude Code
  1. Type any message
  1. 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

View original on GitHub ↗

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