claude-code - 💡(How to fix) Fix [BUG] Hook runner produces git usage text on Windows for all hooks

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Every hook invocation records a non-blocking error: Hooks work correctly and context IS injected — only the error record is wrong. No error should be recorded when a hook runs successfully and injects context. hook error to the user.

Error Messages/Logs

Code Example

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.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. Install Claude Code on Windows 11 with Git for Windows
  2. Enable any plugin with hooks (e.g. superpowers, vercel, remember, caveman)
  3. Open a project directory that is NOT a git repository
  4. Start a session or run /clear
  5. 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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING