104013: Run cancel routing failed
run_cancel_routing_failedAI Transport could not deliver an inbound cancel message to the run it targets. The cancel was neither carried out nor rejected, so the run continues as though the message had not arrived.
What you should do
Cancel the run again if it still needs to stop. Unlike a handler failure, this is not a fault in code you supplied, so there is nothing of your own to fix first; inspect the cause for what went wrong.
You will not catch this from a call you made. Because it arises while the SDK is handling an inbound message, and the failure cannot be attributed to one run, it is delivered to the session's error handler rather than a run's.
Why it happens
When a cancel message arrives, the SDK matches it to the run it targets and fires the cancel against that run. This error is raised when that dispatch itself fails, rather than the run's own onCancel hook rejecting or throwing the cancel. One way it arises is a run's onError handler throwing while it is being told its onCancel failed: that second throw escapes the dispatch. The originating failure is preserved as the cause.
What you'll see
The error is reported with code 104013 and status 500. Messages take the form unable to route cancel message; ....