feat: add PostToolUseFailure hook event type#535
Merged
ashwin-ant merged 1 commit intomainfrom Jan 30, 2026
Merged
Conversation
Add support for the PostToolUseFailure hook event, which fires when a tool use fails. This includes: - PostToolUseFailureHookInput with tool_name, tool_input, tool_use_id, error, and optional is_interrupt fields - PostToolUseFailureHookSpecificOutput with additionalContext field - "PostToolUseFailure" literal added to HookEvent, HookInput, and HookSpecificOutput union types - New types exported from __init__.py and added to __all__ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ollie-anthropic
approved these changes
Jan 30, 2026
phil65
pushed a commit
to phil65/claude-agent-sdk-python
that referenced
this pull request
Jan 30, 2026
## Summary - Add `PostToolUseFailureHookInput` type with fields for `tool_name`, `tool_input`, `tool_use_id`, `error`, and optional `is_interrupt` - Add `PostToolUseFailureHookSpecificOutput` type with `additionalContext` field - Add `"PostToolUseFailure"` to `HookEvent`, `HookInput`, and `HookSpecificOutput` union types - Export new types from `__init__.py` and add to `__all__` ## Test plan - [ ] Verify `PostToolUseFailureHookInput` can be constructed with required and optional fields - [ ] Verify `PostToolUseFailureHookSpecificOutput` accepts valid output shapes - [ ] Verify type checking passes with `mypy` - [ ] Verify existing tests still pass ## Changelog <!-- CHANGELOG:START --> Added `PostToolUseFailure` hook event type for handling tool use failures, including `PostToolUseFailureHookInput` and `PostToolUseFailureHookSpecificOutput` types. <!-- CHANGELOG:END --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) (0% 4-shotted by claude) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PostToolUseFailureHookInputtype with fields fortool_name,tool_input,tool_use_id,error, and optionalis_interruptPostToolUseFailureHookSpecificOutputtype withadditionalContextfield"PostToolUseFailure"toHookEvent,HookInput, andHookSpecificOutputunion types__init__.pyand add to__all__Test plan
PostToolUseFailureHookInputcan be constructed with required and optional fieldsPostToolUseFailureHookSpecificOutputaccepts valid output shapesmypyChangelog
Added
PostToolUseFailurehook event type for handling tool use failures, includingPostToolUseFailureHookInputandPostToolUseFailureHookSpecificOutputtypes.