[Bug] PreToolUse and PostToolUse hooks not invoked on Windows (win32-x64)

Resolved 💬 3 comments Opened Apr 25, 2026 by chinli12 Closed Apr 29, 2026

Bug Description
Issue: PreToolUse and PostToolUse hooks are not invoked on Windows. Environment: - Claude Code 2.1.119 (native, win32-x64) - Windows, Git Bash for shell - Project at C:\dev\flowcraft\ Reproduction: - .claude/settings.json with valid hooks config (current schema: matcher + hooks: [{type, command}] array) - Absolute forward-slash path: bash C:/dev/flowcraft/.claude/hooks/before_bash.sh - Hook script verified working when invoked directly: bash before_bash.sh "git push origin main --force" -> "❌ BLOCKED" + exit 2 Diagnostic that confirms hooks are not invoked: - Added to hook script: echo "$(date) HOOK_INVOKED" >> hook-debug.log - Ran multiple Bash tool calls from within Claude Code session - hook-debug.log was never created (cat returns "No such file or directory") - Same config worked on Linux/Mac per docs Tried (no fix): - Schema corrections (matcher+hooks array vs flat command field) - Path corrections (absolute Windows path with forward slashes) - .gitattributes for LF line endings on .sh files - Multiple session restarts including --debug flag - /doctor command (output shows minimal info, no hooks section) Workaround in use: hooks disabled in settings.json ({}); rely on user's manual approval prompts as primary safety net.

Environment Info

  • Platform: win32
  • Terminal: mintty
  • Version: 2.1.119
  • Feedback ID: 754e81c5-ccfa-4346-b71a-0352db354b77

Errors

[]

View original on GitHub ↗

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