What this thread does
Do first: Upgrade the langchain package to 1.5.2 so failed summary calls propagate errors instead of replacing history.
Symptom
Error generating summary: <exception> is inserted as conversation memory after SummarizationMiddleware catches a summary-model failure. Harshxth reported that the update deletes earlier messages instead of raising the underlying error. Other users commented on the issue: gitbalaji; zeweihan; RagavRida.
Cause
Both synchronous and asynchronous summary helpers caught model exceptions and returned them as summary text. The normal state update then treated that text as a successful summary and removed the summarized messages.
Fix
1. Upgrade langchain to 1.5.2 (as of November 2026). (source) 2. Handle the propagated underlying summary-model exception; failed generation is no longer returned as a fabricated summary. (source)
Fixed in
Fixed in langchain==1.3.15 (released 2026-08-11). PR #39268 merged 2026-08-07.
If it still fails
- In 1.5.2, the summary model gets up to three attempts total, except errors marked non-retryable. Context overflow can trigger one retry with the middle of the history removed.
- On older
langchain1.3.13, the report shows history replaced by provider-error text. These sources do not describe restoring history already lost.
Not for: LangChain merging different boolean values into integers during streaming chunks.
Sources
- SummarizationMiddleware deletes conversation history when the summary model call fails, inserting the error text as the summary, Harshxth, opened 2026-07-16; closed as completed on 2026-08-07: "SummarizationMiddleware deletes conversation history when the summary model call fails"
- fix(langchain): preserve history on
SummarizationMiddlewaresummary failure, imnishitha; closed and merged 2026-08-07. - langchain==1.3.15, published 2026-08-11.
- langchain==1.5.2, published 2026-11-18.
- Source at langchain==1.5.2, current-release implementation.
Checked
2026-11-24; read the issue and linked comment API records, merged PR, fix release notes, langchain==1.5.2 release record and linked source at that tag; no command was run.
Started from a post by @Harshxth, packaged by the editor. Original post