[BUG] PostToolUse prompt hook returning {"ok": false, "reason": ...} terminates the turn instead of feeding reason back to the model

Resolved 💬 3 comments Opened May 3, 2026 by SNHenderson Closed Jun 2, 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?

A PostToolUse prompt hook returning {"ok": false, "reason": "..."} terminates the turn instead of feeding the reason back to the model the way the docs describe. The user has to manually retrigger continuation; auto mode can't recover. Same documented intent (block + feed reason back) as a command hook returning {"decision": "block", "reason": "..."}, which works correctly — so the bug is specific to the prompt-hook block-handling path.

What Should Happen?

Per the prompt-based hooks docs, {"ok": false, "reason": "..."} should block the action and inject the reason back into the model's context as feedback (the way a command-hook block does), so the turn continues and the model can address the issue autonomously.

Error Messages/Logs

# Prompt hook returning {"ok": false, "reason": "..."}:
PostToolUse:Edit hook stopped continuation: TEST: hard-coded prompt-hook block — please acknowledge and continue.

# Equivalent command hook returning {"decision": "block", "reason": "..."}:
PostToolUse:Edit hook blocking error from command: ... TEST: command-hook block — please acknowledge and continue.

# Note the wording differs ("stopped continuation" vs "blocking error from command").
# The command-hook variant feeds the reason to the model and the turn continues.
# The prompt-hook variant ends the turn.

Steps to Reproduce

  1. Put this in ~/.claude/settings.json:
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "prompt",
            "prompt": "Ignore $ARGUMENTS. Always respond with EXACTLY this JSON object and nothing else: {\"ok\": false, \"reason\": \"TEST: hard-coded prompt-hook block — please acknowledge and continue.\"}"
          }
        ]
      }
    ]
  }
}
  1. In a Claude Code session (auto mode), trigger any Edit or Write tool call.
  1. Observe the system reminder: PostToolUse:Edit hook stopped continuation: ...
  1. The turn ends. The model never gets to act on the reason. User must manually retype "continue" or similar.

Same result whether the JSON is hard-coded in the prompt (above) or produced by the LLM's judgment from real input — rules out output flakiness as a cause.

Comparison: equivalent command hook works correctly. Replace the prompt hook with:

{
  "type": "command",
  "command": "echo '{\"decision\": \"block\", \"reason\": \"TEST: command-hook block — please acknowledge and continue.\"}'"
}

Trigger an Edit. The harness emits PostToolUse:Edit hook blocking error from command: ... and the turn continues — the model receives the reason and proceeds.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.126 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Closed-for-inactivity precursors

Same family of bug, all auto-closed without fix:

  • #34601 — "prompt-type PostToolUse hook stops continuation even when the prompt instructs to approve immediately"
  • #33125 — "Agent/Prompt hooks do not block PreToolUse or deliver feedback to Claude"
  • #37559 — "Hook documentation is misleading — Stop hooks broken, prompt hooks can't inject context, capabilities undocumented per event type"
  • #20221 — "Prompt-based SubagentStop hooks send feedback but don't prevent termination"

Related: #25848 (proposes the docs-described feedback-injected behavior as the intended design).

Why this matters

This breaks the primary use case for prompt-based PostToolUse hooks: lightweight LLM-judged policy enforcement (lint-style audits, security checks, style rules). Auto mode can't recover, neutralizing agent autonomy in exactly the place where the docs say feedback should drive corrective action.

View original on GitHub ↗

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