claude-code - 💡(How to fix) Fix [BUG] Hook executor silent fail in v2.1.x — mid-session hooks never invoked despite registration

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

Error Messages/Logs

[WARN] [3P telemetry] Event dropped (no event logger initialized): hook_execution_start

Fix Action

Fix / Workaround

02:32:52 [DEBUG] Loaded inline plugin from path: antigravity-hooks 02:32:52 [DEBUG] Found 1 plugins (1 enabled, 0 disabled) 02:32:52 [DEBUG] Registered 15 hooks from 1 plugins ← REGISTRATION: 15 ✅ 02:32:55 [DEBUG] Hook SessionStart:startup (SessionStart) success: × 2 02:32:55 [DEBUG] Hooks: Found 0 total hooks in registry ← LOOKUP: 0 ❌ 02:33:06 [INFO] [Stall] tool_dispatch_start tool=Bash toolUseId=toolu_01N9Jp919ZXydXrnYREkY3fW permissionDecisionMs=32 02:33:18 [INFO] [Stall] tool_dispatch_end tool=Bash toolUseId=toolu_01N9Jp919ZXydXrnYREkY3fW outcome=ok durationMs=11835 02:33:18 [DEBUG] Hooks: Found 0 total hooks in registry ← LOOKUP again: 0 ❌ 02:33:18 [DEBUG] Hooks: checkForNewResponses returning 0 responses [WARN] [3P telemetry] Event dropped (no event logger initialized): hook_execution_start

Plugin V2 conversion lifts registration from 0 → 15, but mid-session lookup still returns 0. This strongly suggests the plugin loader's registration code path and the mid-session lookup code path (used by checkForNewResponses and tool dispatch) operate on different registries.

Code Example

~/.claude/debug/<uuid>.txt timeline (single session, --debug enabled):

02:32:52  [DEBUG] Loaded inline plugin from path: antigravity-hooks
02:32:52  [DEBUG] Found 1 plugins (1 enabled, 0 disabled)
02:32:52  [DEBUG] Registered 15 hooks from 1 plugins              ← REGISTRATION: 1502:32:55  [DEBUG] Hook SessionStart:startup (SessionStart) success: × 2
02:32:55  [DEBUG] Hooks: Found 0 total hooks in registry          ← LOOKUP: 002:33:06  [INFO]  [Stall] tool_dispatch_start tool=Bash toolUseId=toolu_01N9Jp919ZXydXrnYREkY3fW permissionDecisionMs=32
02:33:18  [INFO]  [Stall] tool_dispatch_end tool=Bash toolUseId=toolu_01N9Jp919ZXydXrnYREkY3fW outcome=ok durationMs=11835
02:33:18  [DEBUG] Hooks: Found 0 total hooks in registry          ← LOOKUP again: 002:33:18  [DEBUG] Hooks: checkForNewResponses returning 0 responses
[WARN]    [3P telemetry] Event dropped (no event logger initialized): hook_execution_start

Decisive contradiction: Registered 15 hooks (plugin loader) vs Found 0 hooks (mid-session lookup). Two different registries / code paths.
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?

Claude Code's hook executor silently skips all mid-session hook events on Windows. Plugin V2 hooks are registered correctly at startup (Registered 15 hooks from 1 plugins in debug log), but the mid-session lookup returns 0 hooks (Hooks: Found 0 total hooks in registry).

Only SessionStart hooks fire. UserPromptSubmit, PreToolUse, PostToolUse, Stop, and TaskCompleted hooks never invoke despite being registered.

The same hook scripts work perfectly when invoked manually via PowerShell stdin pipe, so the bug is in Claude Code's hook executor, not in user scripts.

Confirmed in three versions (v2.1.139, v2.1.144 Antigravity IDE bundled, v2.1.145) and two environments (standalone CLI + Antigravity IDE).

What Should Happen?

Per the documented behavior at https://code.claude.com/docs/en/hooks:

  • When user submits a prompt → UserPromptSubmit hooks should fire
  • Before a tool call → PreToolUse hooks should fire (and can block via exit code 2)
  • After a tool call → PostToolUse hooks should fire
  • When the turn ends → Stop hook should fire

All hooks registered via .claude/settings.local.json or plugin V2 (hooks/hooks.json) should be invoked at their respective events, with stdin payload containing the hook input JSON.

Error Messages/Logs

~/.claude/debug/<uuid>.txt timeline (single session, --debug enabled):

02:32:52  [DEBUG] Loaded inline plugin from path: antigravity-hooks
02:32:52  [DEBUG] Found 1 plugins (1 enabled, 0 disabled)
02:32:52  [DEBUG] Registered 15 hooks from 1 plugins              ← REGISTRATION: 1502:32:55  [DEBUG] Hook SessionStart:startup (SessionStart) success: × 2
02:32:55  [DEBUG] Hooks: Found 0 total hooks in registry          ← LOOKUP: 002:33:06  [INFO]  [Stall] tool_dispatch_start tool=Bash toolUseId=toolu_01N9Jp919ZXydXrnYREkY3fW permissionDecisionMs=32
02:33:18  [INFO]  [Stall] tool_dispatch_end tool=Bash toolUseId=toolu_01N9Jp919ZXydXrnYREkY3fW outcome=ok durationMs=11835
02:33:18  [DEBUG] Hooks: Found 0 total hooks in registry          ← LOOKUP again: 002:33:18  [DEBUG] Hooks: checkForNewResponses returning 0 responses
[WARN]    [3P telemetry] Event dropped (no event logger initialized): hook_execution_start

Decisive contradiction: Registered 15 hooks (plugin loader) vs Found 0 hooks (mid-session lookup). Two different registries / code paths.

Steps to Reproduce

  1. Create .claude/settings.local.json with hooks for multiple events:
    {
      "hooks": {
        "UserPromptSubmit": [
          { "hooks": [{ "type": "command", "command": "powershell -ExecutionPolicy Bypass -File .agents/hooks/log-prompt.ps1" }] }
        ],
        "PostToolUse": [
          { "hooks": [{ "type": "command", "command": "powershell -ExecutionPolicy Bypass -File .agents/hooks/log-tool.ps1" }] }
        ]
      }
    }

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.145 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

⭐ Decisive contradiction — two different registries

Plugin V2 conversion lifts registration from 0 → 15, but mid-session lookup still returns 0. This strongly suggests the plugin loader's registration code path and the mid-session lookup code path (used by checkForNewResponses and tool dispatch) operate on different registries.

Both configurations fail identically

Configuration/hooks UIRegistry logSessionStartMid-session events
.claude/settings.local.json only15 hooks configuredRegistered 0 hooks from 0 plugins✅ fires❌ silent
Plugin V2 (.claude-plugin/plugin.json + hooks/hooks.json)15 hooks configuredRegistered 15 hooks from 1 plugins✅ fires❌ silent

Environment matrix (all show same behavior)

  • npm v2.1.139 (stable channel) — standalone PowerShell
  • npm v2.1.145 (latest channel) — standalone PowerShell
  • Antigravity IDE v2.1.144 — bundled native-binary

Full debug log available

Happy to attach the complete 141KB debug log (~/.claude/debug/<uuid>.txt) on request. A reproducible project structure is publicly available at the GitHub repository.

Reference

Documented hook events behavior: https://code.claude.com/docs/en/hooks

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