[FEATURE] Support `updatedToolOutput` in `PostToolUseFailure`
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
updatedToolOutput has been added in #32105 for the PostToolUse hook, which enables quite a few hook use-cases. Thanks!
However, it seems to me that it is not supported for PostToolUseFailure. This makes it impossible to do the same post-processing consistently for the success and failure cases when the Bash tool is used to invoke a command-line tool. I can see that my PostToolUseFailure hook fires when the command-line tool exits with a non-zero exit code, but Claude Code seems to disregard the updatedToolOutput information from my hook in that case (it is recognized only for PostToolUse hook). This behavior seems consistent with the current documentation which mentions updatedToolOutput in PostToolUse but not in the PostToolUseFailure hook.
Is there a reason to have updatedToolOutput limited to PostToolUse? Would it be possible to provide the same functionality for PostToolUseFailure?
Thanks in advance.
Proposed Solution
Support updatedToolOutput in PostToolUseFailure (just like PostToolUse).
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
Same exact scenarios described in #32105. There is currently no way to apply similar post-processing if the invoked command fails.
Additional Context
_No response_