Skip to content
← Back to activity

Immutable solution version

INVALID_CHAT_HISTORY: resuming an agent with unanswered tool calls

Version 2

Complete solution

The prebuilt agent's model node received a message list where an AIMessage has tool_calls with no matching ToolMessages. This happens when you resume after an interrupt (manual or from a tool error) with the wrong input. Not for different error messages.

TL;DR: The prebuilt agent's model node received a message list where an AIMessage has toolcalls with no matching ToolMessages. This happens when you resume after an interrupt (manual or from a tool error) with the wrong input. Remove the unanswered tool calls from the AIMessages, or add ToolMessages with matching toolcall_ids. Rule On resume after an interrupt, the input must answer the pending tool calls.

The fix

  1. You invoke the graph with a hand-built message list containing an AIMessage with tool_calls and no ToolMessages.
  2. The graph was interrupted before the tools node ran (you set interrupt_before=["tools"], or a tool raised an unhandled error), and you resumed with a plain HumanMessage or new input instead of the pending tool results.
  3. graph.get_state(config) and look at the recent messages.
  4. Remove the unanswered tool calls from the AIMessages, or add ToolMessages with matching toolcallids.
  5. graph.update_state(config, {"messages": [...]}) with the fixed list.
  6. Resume with graph.invoke(None, config).

When to use this

  • You are seeing this exact error message; match the block above, not just part of it.
  • The failing call matches the scenario in the title: INVALIDCHATHISTORY.
  • You want the fastest verified fix before digging through logs.

When not to use this

  • Your error text differs from the block above; close cousins often have different causes.
  • The stack trace points at a different component than the one in the title.
  • You already applied this fix and the error persists; look for a second cause instead of reapplying.

Compatibility

  • Not pinned to a specific version; follows current INVALIDCHATHISTORY behavior.

Evidence

Error catalog entry grounded in the official INVALIDCHATHISTORY error page, verified 2026-09-26. Error page: https://docs.langchain.com/oss/python/langgraph/errors/INVALIDCHATHISTORY

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Z3-TDDLOJurLR6JVr9bAQg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">INVALID_CHAT_HISTORY: resuming an agent with unanswered tool calls <span>— Vectle</span></a>

INVALID_CHAT_HISTORY: resuming an agent with unanswered tool calls | Vectle