[BUG] Prompt-type Stop hook returns {"ok": false} but stop is not blocked

Status Fixed / completed
Reported on v2.1.71
Maintainer reply None cached
Activity 4 comments · opened Mar 9, 2026 · closed Apr 3, 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?

When a prompt-type Stop hook correctly returns {"ok": false, "reason": "..."}, Claude Code logs "Prompt hook condition was not met" but still allows the stop. The agent does not continue working — it stops, and the reason is surfaced as feedback in the next user turn instead.

Steps to Reproduce

  1. Add a prompt-type Stop hook to ~/.claude/settings.json:
{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "prompt",
            "prompt": "Does this message ask the user whether to commit or push?\n\nMessage: $LAST_ASSISTANT_MESSAGE\n\nIf yes: {\"ok\": false, \"reason\": \"Do not ask — proceed with committing.\"}\nIf no: {\"ok\": true}",
            "timeout": 30
          }
        ]
      }
    ]
  }
}
  1. Ask Claude to respond with a message like "Want me to commit these changes?"
  2. Claude stops after outputting the message
  3. The Stop hook evaluates and correctly returns {"ok": false}

Debug Log Evidence

2026-03-09T21:40:02.599Z [DEBUG] Hooks: Model response: {"ok": false, "reason": "Do not ask — proceed with committing and pushing to Gerrit."}
2026-03-09T21:40:02.599Z [DEBUG] Hooks: Prompt hook condition was not met: Do not ask — proceed with committing and pushing to Gerrit.
...
2026-03-09T21:40:02.605Z [DEBUG] Stopped caffeinate, allowing sleep

The hook correctly parses, correctly identifies the condition was not met, but the stop proceeds anyway.

What Should Happen?

When a prompt-type Stop hook returns {"ok": false}, Claude should not stop and should continue working, using the reason as guidance — the same behavior as when a command-type Stop hook blocks a stop. This is consistent with the documentation on Prompt Hooks and their output schemas.

Additional Context

  • Related but distinct from #11947 (which is about Haiku returning malformed JSON). In this case the JSON is valid and correctly parsed.
  • Claude Code version: 2.1.71
  • Platform: macOS (Darwin 25.4.0)
  • The prompt hook is evaluated by Haiku (claude-haiku-4-5-20251001 per debug logs)
  • Note: Haiku also intermittently fails to return valid JSON for prompt hooks (lines 490-491 in debug log show error parsing response as JSON), but that is covered by #11947. This issue is specifically about the case where parsing succeeds but the result is ignored.

View original on GitHub ↗

4 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/20221
  2. https://github.com/anthropics/claude-code/issues/29991
  3. https://github.com/anthropics/claude-code/issues/22009

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

yurukusa · 6 months ago

Stop hooks should use command type, not prompt type:

{"hooks":{"Stop":[{"hooks":[{"type":"command","command":"bash ~/.claude/hooks/stop.sh"}]}]}}

Prompt-type hooks are not supported for Stop events.

jomonson · 6 months ago

@yurukusa This says otherwise.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.