[Bug] Agent hooks fail with "Messages are required for agent hooks" when using prompt field

Resolved 💬 3 comments Opened Apr 19, 2026 by fernsrenato28 Closed Apr 22, 2026

Bug Description
Bug: PreToolUse agent hooks fail with "Messages are required for agent hooks" Configuring a hook with "type": "agent" and a "prompt" field (per the documented schema at docs.claude.com/en/docs/claude-code/hooks) fails at runtime with: ▎ Failed to run: Messages are required for agent hooks. This is a bug. Repro — add to .claude/settings.json: { "hooks": { "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "agent", "if": "Bash(git commit*)", "prompt": "Review the staged diff for issues.", "timeout": 120 }] }] …
Note: Content was truncated.

View original on GitHub ↗

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