[BUG] Hook executor silent fail in v2.1.x — mid-session hooks never invoked despite registration

Resolved 💬 3 comments Opened May 20, 2026 by tpwhdtbxkdls2-byte Closed Jun 19, 2026

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?

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: 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

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:

```json
{
"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 UI | Registry log | SessionStart | Mid-session events |
|---|---|---|---|---|
| .claude/settings.local.json only | 15 hooks configured | Registered 0 hooks from 0 plugins | ✅ fires | ❌ silent |
| Plugin V2 (.claude-plugin/plugin.json + hooks/hooks.json) | 15 hooks configured | Registered 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

View original on GitHub ↗

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