{"record":{"id":"ad16770bc522d69a","repo":"bytedance/deer-flow","slug":"message-session-session-id","errorCode":null,"errorMessage":"{message} (session={session_id})","messagePattern":"(.+?) \\(session=(.+?)\\)","errorType":"exception","errorClass":"MemoryManagerError","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/openviking/openviking_manager.py","lineNumber":540,"sourceCode":"        finally:\n            try:\n                temp_path.unlink(missing_ok=True)\n            except OSError:\n                logger.debug(\n                    \"Failed to remove OpenViking cursor temp file: %s\",\n                    temp_path,\n                    exc_info=True,\n                )\n\n    def _handle_write_error(\n        self,\n        exc: Exception,\n        message: str,\n        session_id: str,\n    ) -> None:\n        detail = f\"{message} (session={session_id})\"\n        if self._config.write_failure_policy == \"raise\":\n            raise MemoryManagerError(detail) from exc\n        logger.error(detail, exc_info=True)\n\n\ndef _load_official_integration() -> dict[str, Any]:\n    try:\n        from langchain_openviking import (\n            OpenVikingCommitPolicy,\n            OpenVikingPartialWriteError,\n            OpenVikingRetriever,\n            OpenVikingSessionRecorder,\n            has_request_actor_peer_support,\n        )\n        from langchain_openviking.actor_peer import use_actor_peer\n    except ImportError as exc:\n        raise ImportError(\"The OpenViking memory backend requires langchain-openviking==0.1.0. Install DeerFlow backend dependencies and retry.\") from exc\n    if not has_request_actor_peer_support():\n        raise ImportError(\"The installed OpenViking SDK lacks request-scoped actor-peer support. Install openviking-sdk>=0.1.6,<0.2 and retry.\")\n    return {","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/openviking/openviking_manager.py#L522-L558","documentation":"_handle_write_error() builds the detail message '{message} (session={session_id})' around an underlying capture exception. When memory.backend_config.failure_policy.write is 'raise', it re-raises as MemoryManagerError chained from the original exception; with the default 'log_and_drop' it logs at ERROR with the traceback instead and the conversation turn proceeds. The {message} placeholder itself comes from the capture step (e.g. OpenVikingPartialWriteError handling).","triggerScenarios":"Any exception during _capture_locked/recorder commit — OpenViking service 5xx, network timeout, OpenVikingPartialWriteError — on a session where write_failure_policy='raise'. The raised MemoryManagerError carries the session_id for correlation.","commonSituations":"OpenViking outage mid-conversation while running with write: raise to make capture failures visible; the default config only logs, so operators typically first see this as an ERROR log line with the same text.","solutions":["Check the chained original exception (raise ... from exc) and Gateway logs — the root cause is transport/service-side, not this wrapper","Verify the OpenViking service health and base_url/api_key, then retry the conversation turn; the cursor ensures already-captured messages are not replayed","If capture failures should not break turns, set memory.backend_config.failure_policy.write: log_and_drop"],"exampleFix":"# before (config.yaml): capture failures abort turns\nmemory:\n  backend_config:\n    failure_policy:\n      write: raise\n\n# after: log and continue\nmemory:\n  backend_config:\n    failure_policy:\n      write: log_and_drop","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from deerflow.agents.memory.manager import MemoryManagerError\ntry:\n    manager.add(thread_id, messages, user_id=user)\nexcept MemoryManagerError as exc:\n    logger.error(\"OpenViking capture failed: %s\", exc, exc_info=exc.__cause__)\n    # cursor state is preserved; retrying the turn is safe (no duplicate replay)","preventionTips":["Keep failure_policy.write at log_and_drop unless capture loss must be visible","Investigate __cause__ (the original SDK exception) rather than the wrapper message","Monitor OpenViking service health so write failures stay rare"],"tags":["openviking","memory","write-failure","error-handling"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}