{"version":"2.1.328","anchor":"posttooluse-hook-rewrites-are-now-validated-against-the-tool","canonical_anchor":"posttooluse-hook-rewrites-are-now-validated-against-the-tool","heading":"Hooks that rewrite a tool's result badly now cause an error for some tools","tier":"notice","area":"Hooks","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.328\/e\/posttooluse-hook-rewrites-are-now-validated-against-the-tool","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.328","markdown":"### Hooks that rewrite a tool's result badly now cause an error for some tools\n\nFor some tools, a PostToolUse hook that rewrites a result into the wrong shape now produces an error instead of being silently ignored\n\n**Unclear.** Which tools get the new check is not stated.\n\n**What**\n\nA `PostToolUse` hook is a command you set up to run after a tool call succeeds. A tool call is one action Claude takes, such as reading a file or running a command. A hook of this kind can replace the result the tool returned.\n\nBefore, a replacement result was used only if it matched the shape the tool's output is supposed to have. If it did not match, it was dropped without any message. For some tools, Claude Code now checks the result after all hooks have run, and handles a bad result like this:\n\n- A managed `PostToolUse` hook (one set by an administrator) that returns a result in the wrong shape makes the tool call fail with an error naming the tool.\n\n- A hook that replaces the result with a list whose items are not all content blocks makes the call fail with a different error.\n\n- In other cases, Claude Code falls back to the tool's original output.\n\n**Why**\n\nPeople who write hooks now get a clear error when a rewrite is wrong, instead of having it quietly ignored.\n\n- Area: Hooks\n- Names: `PostToolUse`\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: yes"}