{"version":"2.1.78","anchor":"stopfailure-hook-event","canonical_anchor":"stopfailure-hook-event","heading":"StopFailure Hook Event","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.78\/e\/stopfailure-hook-event","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.78","markdown":"### StopFailure Hook Event\n\n**What**\n\nA new hook event type that fires when a turn ends due to an API error (rate limit, auth failure, billing error, etc.), distinct from the normal `Stop` event.\n\n**Usage**\n\n`{ \"hooks\": { \"StopFailure\": [ { \"type\": \"command\", \"command\": \"echo 'API error: $CLAUDE_HOOK_ERROR'\" } ] } }` **Details** - Fires instead of `Stop` when an API error ended the turn - Fire-and-forget \u2014 hook output and exit codes are ignored - Supports matching on error type: `rate_limit`, `authentication_failed`, `billing_error`, `invalid_request`, `server_error`, `max_output_tokens`, `unknown` **Evidence** Hook event definition (search for `\"StopFailure\"`) \u2014 added to the hook event schema with `matcherMetadata` on `\"error\"` field"}