[BUG] Hook runner produces git usage text on Windows for all hooks
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?
Every hook invocation records a non-blocking error:
- stdout:
usage: git [-v | --version] [-h | --help]... - stderr: "Failed with non-blocking status code: No stderr output"
- exit code: 1
This affects ALL hook events (SessionStart, UserPromptSubmit, PostToolUse, Stop).
Hooks work correctly and context IS injected — only the error record is wrong.
Platform: Windows 11 Pro, Git for Windows bash, Claude Code 2.1.145.
Project directory is not a git repository.
The git usage text is identical across all hook types and all plugin hooks,
suggesting it originates in the hook runner infrastructure rather than any
individual hook script.
What Should Happen?
No error should be recorded when a hook runs successfully and injects context.
If a git context check is intended, its failure should not be surfaced as a
hook error to the user.
Error Messages/Logs
From session JSONL (~/.claude/projects/<slug>/<session>.jsonl):
{
"type": "hook_non_blocking_error",
"hookName": "SessionStart:clear",
"hookEvent": "SessionStart",
"stderr": "Failed with non-blocking status code: No stderr output",
"stdout": "usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n [-p | --paginate | -P |
--no-pager]..."
}
This record appears once per registered hook per session start (6 hooks = 6 identical records with
the same toolUseID). The same pattern appears for every hook event type: PostToolUse:Read,
UserPromptSubmit, Stop, etc.
Steps to Reproduce
- Install Claude Code on Windows 11 with Git for Windows
- Enable any plugin with hooks (e.g. superpowers, vercel, remember, caveman)
- Open a project directory that is NOT a git repository
- Start a session or run /clear
- Observe non-blocking hook errors in the UI
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.145
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗