Undocumented 'ok' field required in prompt hook responses
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
- Create a UserPromptSubmit prompt hook that returns only
{"systemMessage": "..."}(as implied by documentation) - Restart Claude Code
- Trigger the hook
- 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗