{"version":"2.1.314","anchor":"new-typed-api-error-kinds-for-connection-failures","canonical_anchor":"new-typed-api-error-kinds-for-connection-failures","heading":"Lost API connections are now labelled by cause","tier":"notice","area":"Agents","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.314\/e\/new-typed-api-error-kinds-for-connection-failures","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.314","markdown":"### Lost API connections are now labelled by cause\n\nAPI errors gain the kinds `connection_failed`, `stream_idle_timeout` and `computer_slept`, so a dropped connection says why it was lost\n\n**What**\n\nThe list of error kinds Claude Code can report for a failed request to the API now includes three more:\n\n- `connection_failed`: the network connection failed.\n\n- `stream_idle_timeout`: Claude Code's own idle timer gave up waiting for the reply to continue.\n\n- `computer_slept`: the connection dropped because the computer went to sleep.\n\nWhen the connection to the API is lost, the error now carries one of these as its `apiError` field, either `computer_slept` or `connection_failed`. A suspended stream (`StreamSuspended`) is never labelled `connection_failed`. The message you see, \"Connection to the API was lost\", is unchanged. Before, this error had no `apiError` field.\n\n**Why**\n\nPrograms built on Claude Code through the SDK can tell a sleeping computer apart from a network failure or a timeout, and react to each differently.\n\n- Area: Agents\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}