{"record":{"id":"f99159f18ac4ab41","repo":"langchain-ai/deepagents","slug":"offloading-conversation-history-to-backend-failed","errorCode":null,"errorMessage":"Offloading conversation history to backend failed during summarization. Older messages will not be recoverable.","messagePattern":"Offloading conversation history to backend failed during summarization\\. Older messages will not be recoverable\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"libs/deepagents/deepagents/middleware/summarization.py","lineNumber":1434,"sourceCode":"                max_input_tokens=self._get_profile_limits(),\n                token_counter=self.token_counter,\n                large_tool_results_prefix=self._large_tool_results_prefix,\n            )\n\n        # Upload inline media once so both offload and summary see path references.\n        offloaded_media_messages, failed_media = self._offload_inline_media(backend, messages_to_summarize)\n\n        # Resolve the internal history-file id and persist it below so later turns\n        # append to the same file.\n        session_id = self._get_session_id(request.state)\n\n        # Offload to backend first so history is preserved before summarization.\n        # If offload fails, summarization still proceeds (with file_path=None).\n        file_path = self._offload_to_backend(backend, offloaded_media_messages, session_id)\n        if file_path is None:\n            msg = \"Offloading conversation history to backend failed during summarization. Older messages will not be recoverable.\"\n            logger.error(msg)\n            warnings.warn(msg, stacklevel=2)\n        elif failed_media:\n            # History was saved, but some media became failed-offload placeholders.\n            # Tie the warning to the saved file so the recovery pointer is honest.\n            msg = (\n                f\"Conversation history was offloaded to {file_path}, but {failed_media} media \"\n                \"block(s) could not be offloaded and appear as failed placeholders in the saved \"\n                \"history; the original media is not recoverable.\"\n            )\n            logger.warning(msg)\n            warnings.warn(msg, stacklevel=2)\n\n        # Generate summary\n        summary = self._create_summary(offloaded_media_messages)\n\n        # Build summary message with file path reference\n        new_messages = self._build_new_messages_with_path(summary, file_path)\n\n        previous_event = request.state.get(\"_summarization_event\")","sourceCodeStart":1416,"sourceCodeEnd":1452,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/middleware/summarization.py#L1416-L1452","documentation":"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`.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Inspect the logged backend error preceding this warning to find the root cause (auth, connectivity, permissions)","Verify the backend configuration and that the store is writable with sufficient quota","Retry the turn / re-run after restoring backend connectivity; note older messages offloaded in that run are not recoverable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# before long sessions, verify the backend is writable\nbackend.put((\"healthcheck\",), b\"ok\")","typeGuard":null,"tryCatchPattern":"import warnings\nwith warnings.catch_warnings(record=True) as caught:\n    warnings.simplefilter(\"always\")\n    result = agent.invoke(input)\nfor w in caught:\n    if \"Offloading conversation history\" in str(w.message):\n        logger.critical(\"summarization lost history; check backend connectivity\")","preventionTips":["Monitor backend health/latency in long-running agent deployments","Rotate credentials before expiry and test writes in a readiness probe","Set backend storage quotas/permissions before rollout"],"tags":["summarization","backend","storage","data-loss"],"backgroundTag":"backend-offload-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}