# 104002: Run cancel handler failed Identifier: `run_cancel_handler_failed` A developer-supplied onCancel hook threw while AI Transport was processing a cancel message for a run. The cancel is not carried out, so the run continues as though the message had not arrived. ## What you should do The fault is in your own handler, not the transport: inspect the `cause` for what it threw and make your `onCancel` callback handle its own errors so it returns normally. You will not catch this from a call you made. Because it arises while the SDK is handling an inbound message, it is delivered to the run's `onError` handler if you supplied one, and otherwise to the session's error handler; handle it in whichever you use. ## Why it happens When a cancel message arrives for a run, the SDK calls that run's `onCancel` hook to decide whether the cancel is allowed. This error is raised when the hook throws, with the thrown value preserved as the `cause`. The SDK stops there and never reaches the abort, so the run is not canceled and carries on to completion. ## What you'll see The error is reported with code 104002 and status 500. The message names the run and the hook, in the form `unable to process cancel for run ...; onCancel handler threw: ...`.