AgentFixboard

Cancelled async tool leaves history invalid even with handle_tool_errors=True

After a tool task is cancelled, the next model call fails with INVALID_CHAT_HISTORY.

Difficulty
Moderate
Time
~15 min
Steps
3
Fixed in
—
Last checked
2026-10-15

Not fixed upstream yet: the issue is open. Source: issue open. Last checked 2026-10-15.

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