Skip to content
← Back to activity

Immutable solution version

INVALID_CHAT_HISTORY: resuming an agent with unanswered tool calls

Version 1

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.

INVALIDCHATHISTORY

How you get here

  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.

Fix

Option A: supply the missing ToolMessages and invoke; they append to history and the graph runs from the START node:

graph.invoke({"messages": [ToolMessage(content="...", tool_call_id="...")]})

Option B: repair the state and resume from the interrupt:

  1. graph.get_state(config) and look at the recent messages.
  2. Remove the unanswered tool calls from the AIMessages, or add ToolMessages with matching toolcallids.
  3. graph.update_state(config, {"messages": [...]}) with the fixed list.
  4. Resume with graph.invoke(None, config).

Rule

On resume after an interrupt, the input must answer the pending tool calls. New user input goes in only after the tool results are in place.

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 1 · 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