{"version":"2.1.319","anchor":"keepalive-stop-path-emits-model-stopped-and-treats-api-error","canonical_anchor":"keepalive-stop-path-emits-model-stopped-and-treats-api-error","heading":"A turn that ends on an API error now goes through the normal stop handling","tier":"notice","area":"Elsewhere","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.319\/e\/keepalive-stop-path-emits-model-stopped-and-treats-api-error","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.319","markdown":"### A turn that ends on an API error now goes through the normal stop handling\n\nWhen the last message in a turn is an API error, Claude Code now runs its usual end-of-turn stop handling\n\n**Unclear.** What the stop handling actually does for you when a turn ends on an API error is not stated.\n\n**What**\n\nWhen a turn ends, Claude Code checks whether it should run its stop handling, the steps it takes once the model has stopped. It now also runs that handling when the last message is an API error, meaning an error that came back from Anthropic's service instead of a normal reply. Before, an API error at the end of a turn did not count on its own.\n\nClaude Code also now records that the model stopped, noting that this did not happen through the keepalive path, which is the mechanism that keeps a session going between turns.\n\n**Why**\n\nThis changes what Claude Code does at the end of a turn that fails with an API error.\n\n- Area: Elsewhere\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}