langchain-ai/deepagents · warning

Offloading conversation history to backend failed during sum

Error message

Offloading conversation history to backend failed during summarization. Older messages will not be recoverable.

What it means

During synchronous summarization, the middleware first offloads the trimmed conversation history to the configured backend so older messages remain recoverable. If `_offload_to_backend` returns None (the backend write failed), summarization still proceeds but history is lost, so this message is logged and warned. The summary continues with `file_path=None`.

Source

Thrown at libs/deepagents/deepagents/middleware/summarization.py:1434

                max_input_tokens=self._get_profile_limits(),
                token_counter=self.token_counter,
                large_tool_results_prefix=self._large_tool_results_prefix,
            )

        # Upload inline media once so both offload and summary see path references.
        offloaded_media_messages, failed_media = self._offload_inline_media(backend, messages_to_summarize)

        # Resolve the internal history-file id and persist it below so later turns
        # append to the same file.
        session_id = self._get_session_id(request.state)

        # Offload to backend first so history is preserved before summarization.
        # If offload fails, summarization still proceeds (with file_path=None).
        file_path = self._offload_to_backend(backend, offloaded_media_messages, session_id)
        if file_path is None:
            msg = "Offloading conversation history to backend failed during summarization. Older messages will not be recoverable."
            logger.error(msg)
            warnings.warn(msg, stacklevel=2)
        elif failed_media:
            # History was saved, but some media became failed-offload placeholders.
            # Tie the warning to the saved file so the recovery pointer is honest.
            msg = (
                f"Conversation history was offloaded to {file_path}, but {failed_media} media "
                "block(s) could not be offloaded and appear as failed placeholders in the saved "
                "history; the original media is not recoverable."
            )
            logger.warning(msg)
            warnings.warn(msg, stacklevel=2)

        # Generate summary
        summary = self._create_summary(offloaded_media_messages)

        # Build summary message with file path reference
        new_messages = self._build_new_messages_with_path(summary, file_path)

        previous_event = request.state.get("_summarization_event")

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Inspect the logged backend error preceding this warning to find the root cause (auth, connectivity, permissions)
  2. Verify the backend configuration and that the store is writable with sufficient quota
  3. Retry the turn / re-run after restoring backend connectivity; note older messages offloaded in that run are not recoverable
Defensive patterns

Strategy: try-catch

Validate before calling

# before long sessions, verify the backend is writable
backend.put(("healthcheck",), b"ok")

Try / catch

import warnings
with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    result = agent.invoke(input)
for w in caught:
    if "Offloading conversation history" in str(w.message):
        logger.critical("summarization lost history; check backend connectivity")

Prevention

When it happens

Trigger: `wrap_model_call` reaches the summarization threshold and calls `_offload_to_backend`, which returns None — e.g. the backend's put/write operation fails, returns falsy, or no usable path is produced.

Common situations: Unreachable or misconfigured backend store (bad credentials, expired token); read-only or full storage; transient network failures between the agent and its state backend during long sessions.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/f99159f18ac4ab41. Report an issue: GitHub.