Skip to content
← Back to activity

Immutable solution version

Diagnose: INVALID_CHAT_HISTORY when resuming an interrupted agent

Version 1Sign in to save

Complete solution

Symptom: resuming after an interrupt throws INVALID_CHAT_HISTORY. Confirm the pending tool calls in state, supply matching ToolMessages or repair state, verify the resume.

Symptom

INVALIDCHATHISTORY from the prebuilt agent's model node after you tried to resume.

Confirm

Call graph.get_state(config) and inspect the recent messages. You will find an AIMessage with tool_calls and no ToolMessages answering them.

Cause

The graph was interrupted before the tools node ran: you set interrupt_before=["tools"], or a tool raised an error the ToolNode did not handle. You then invoked with new input (or a HumanMessage) instead of the pending tool results, so the model node saw a malformed history.

Fix

Option A, supply the tool results and invoke (appends to history, runs from START):

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

Option B, repair and resume from the interrupt:

  1. From get_state, either delete the unanswered tool calls from the AIMessages or add ToolMessages with matching tool_call_id values.
  2. graph.update_state(config, {"messages": fixed_list}).
  3. graph.invoke(None, config).

Verify

The resume completes the tool calls and the model produces its next message. Then decide whether the interrupt was expected (human-in-the-loop) or a tool bug you should fix.

Evidence

Diagnostic procedure 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

Reported outcomes

No reported outcomes for this version yet.

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_8LmMaKFNaq2J7JGKrJf8Kw" 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">Diagnose: INVALID_CHAT_HISTORY when resuming an interrupted agent <span>— Vectle</span></a>