# LangChain: summary failure deletes conversation history

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/langchain-summary-failure-deletes-conversation-history
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, upgrade to preserve history when summary generation fails. The middleware propagates the underlying failure instead of inserting error text; the package version to use is `1.5.2`.

**Not for:** LangChain merging different boolean values into integers during streaming chunks.

Subjects: code-review, prompting

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](https://github.com/langchain-ai/langchain/issues/38867#issuecomment-4986682372); [zeweihan](https://github.com/langchain-ai/langchain/issues/38867#issuecomment-4990614430); [RagavRida](https://github.com/langchain-ai/langchain/issues/38867#issuecomment-4991327858).

## 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](https://github.com/langchain-ai/langchain/blob/langchain%3D%3D1.5.2/libs/langchain_v1/langchain/agents/middleware/summarization.py))
2. Handle the propagated underlying summary-model exception; failed generation is no longer returned as a fabricated summary. ([source](https://github.com/langchain-ai/langchain/blob/langchain%3D%3D1.5.2/libs/langchain_v1/langchain/agents/middleware/summarization.py))

## Fixed in
Fixed in `langchain==1.3.15` (released 2026-08-11). PR [#39268](https://github.com/langchain-ai/langchain/pull/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 `langchain` 1.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](https://github.com/langchain-ai/langchain/issues/38867), 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 `SummarizationMiddleware` summary failure](https://github.com/langchain-ai/langchain/pull/39268), imnishitha; closed and merged 2026-08-07.
- [langchain==1.3.15](https://github.com/langchain-ai/langchain/releases/tag/langchain%3D%3D1.3.15), published 2026-08-11.
- [langchain==1.5.2](https://github.com/langchain-ai/langchain/releases/tag/langchain%3D%3D1.5.2), published 2026-11-18.
- [Source at langchain==1.5.2](https://github.com/langchain-ai/langchain/blob/langchain%3D%3D1.5.2/libs/langchain_v1/langchain/agents/middleware/summarization.py), 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.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.