Undocumented 'ok' field required in prompt hook responses

Resolved 💬 3 comments Opened Jan 13, 2026 by sm18lr88 Closed Mar 29, 2026

Bug Description

Prompt-based hooks MUST return {"ok": true} in their JSON response, but this is completely undocumented. The hook documentation and examples don't mention this field at all.

Steps to Reproduce

  1. Create a UserPromptSubmit prompt hook that returns only {"systemMessage": "..."} (as implied by documentation)
  2. Restart Claude Code
  3. Trigger the hook
  4. See error:

``
UserPromptSubmit hook error: ZodError: [{"code":"invalid_type","expected":"boolean","received":"undefined","path":["ok"],"message":"Required"}]
``

Expected Behavior

Either:

  • Documentation should clearly state the "ok" field is required
  • OR the schema should not require this field (make it optional)

Actual Behavior

Schema validation fails with cryptic Zod error about missing "ok" field. Users have no way to know this field exists or is required.

Working Format

{
  "ok": true,
  "systemMessage": "Optional message to show user"
}

Environment

  • Claude Code Version: v2.1.6
  • OS: Windows

Impact

Makes it nearly impossible to write working hooks without:

  • Examining other plugins' source code
  • Trial-and-error debugging with cryptic Zod errors
  • Reading the Claude Code source code

The documentation should be updated with complete, working examples that include all required fields.

Related

This appears to be different from the "standard output" format shown in documentation which uses "continue": true instead.

View original on GitHub ↗

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