claude-code - 💡(How to fix) Fix Agent hook type fails: Messages are required for agent hooks [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47805Fetched 2026-04-15 06:41:49
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

Error Message

PostToolUse hook with type agent fails with error: Failed to run: Messages are required for agent hooks. Config uses prompt field as required by schema. Runtime rejects it anyway.

RAW_BUFFERClick to expand / collapse

PostToolUse hook with type agent fails with error: Failed to run: Messages are required for agent hooks. Config uses prompt field as required by schema. Runtime rejects it anyway.

extent analysis

TL;DR

The PostToolUse hook with type agent may require a messages field instead of or in addition to the prompt field to resolve the error.

Guidance

  • Verify the schema requirements for the PostToolUse hook with type agent to confirm if both prompt and messages fields are necessary.
  • Check the runtime configuration to ensure it aligns with the schema and that the messages field is properly formatted and included.
  • Consider adding a messages field to the hook configuration, even if the schema suggests prompt is sufficient, to see if this resolves the runtime error.
  • Review any recent changes to the schema or runtime environment that might have introduced this discrepancy.

Example

No code snippet can be provided without more context on the schema and configuration format.

Notes

The issue seems to stem from a mismatch between the schema requirements and the runtime expectations. Without more details on the schema and configuration, it's challenging to provide a definitive fix.

Recommendation

Apply workaround: Add a messages field to the PostToolUse hook configuration to align with the runtime's apparent requirements, as this seems to be the most direct path to resolving the error.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING