Symptom
After a tool task is cancelled, the next model call fails with INVALID_CHAT_HISTORY.
Evidence what you'll see
- An assistant message has tool_calls with no matching tool messages
- The tool was stopped with task.cancel() or a timeout that raises CancelledError
Cause
asyncio.CancelledError subclasses BaseException, not Exception. ToolNode's error handler catches only Exception, so no error tool message is written.
Fix steps
0 of 3 done
Your check marks stay in this browser only.
Verify the fix worked
- Force a timeout: the history now contains an error tool message and the next turn runs.
Did this fix it?
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Test in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change