{"record":{"id":"b88308867da49cbf","repo":"bytedance/deer-flow","slug":"the-openviking-automatic-memory-backend-supports-m","errorCode":null,"errorMessage":"The OpenViking automatic-memory backend supports memory.mode='middleware' only; use OpenViking MCP for explicit model tools","messagePattern":"The OpenViking automatic-memory backend supports memory\\.mode='middleware' only; use OpenViking MCP for explicit model tools","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/openviking/openviking_manager.py","lineNumber":98,"sourceCode":"            limit=self._config.search_top_k,\n            score_threshold=self._config.score_threshold,\n            context_types=(\"memory\",),\n            content_mode=self._config.content_mode,\n            max_content_chars=self._config.max_injection_chars,\n        )\n        self._use_actor_peer = integration[\"use_actor_peer\"]\n        self._partial_write_error = integration[\"OpenVikingPartialWriteError\"]\n\n    @classmethod\n    def from_config(\n        cls,\n        backend_config: dict[str, Any] | None = None,\n        *,\n        mode: Literal[\"middleware\", \"tool\"] = \"middleware\",\n        **host_hooks: Any,\n    ) -> OpenVikingMemoryManager:\n        if mode != \"middleware\":\n            raise ValueError(\"The OpenViking automatic-memory backend supports memory.mode='middleware' only; use OpenViking MCP for explicit model tools\")\n        instance = cls(backend_config=backend_config or {}, mode=mode)\n        hidden_filter = host_hooks.get(\"should_keep_hidden_message\")\n        instance._should_keep_hidden_message = hidden_filter if callable(hidden_filter) else None\n        return instance\n\n    def add(\n        self,\n        thread_id: str,\n        messages: list[Any],\n        *,\n        agent_name: str | None = None,\n        user_id: str | None = None,\n        trace_id: str | None = None,\n    ) -> None:\n        del trace_id\n        self._write_conversation(\n            thread_id,\n            messages,","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/openviking/openviking_manager.py#L80-L116","documentation":"OpenVikingMemoryManager.from_config() hard-rejects memory.mode='tool'. The OpenViking automatic-memory backend deliberately supports only passive middleware capture/recall; explicit model-facing memory tools are provided by the separate OpenViking MCP integration instead. Any other mode value raises this ValueError before the backend is constructed.","triggerScenarios":"Configuring config.yaml with memory.manager_class: openviking together with memory.mode: tool. The factory is invoked during memory manager construction at Gateway startup (or agent rebuild), so the process fails to bring the memory subsystem up.","commonSituations":"Switching an experimental tool-mode setup (previously used with honcho or DeerMem, which do support tool mode) to the OpenViking backend without changing memory.mode back to middleware.","solutions":["Set memory.mode: middleware (or remove the key — middleware is the default) when memory.manager_class: openviking","If you need explicit memory_search/memory_add model tools against OpenViking, use the OpenViking MCP integration instead of the automatic-memory backend","Restart the Gateway after the config change"],"exampleFix":"# before (config.yaml)\nmemory:\n  manager_class: openviking\n  mode: tool\n\n# after\nmemory:\n  manager_class: openviking\n  mode: middleware","handlingStrategy":"validation","validationCode":"mode = memory_cfg.get(\"mode\", \"middleware\")\nmanager_class = memory_cfg.get(\"manager_class\")\nassert not (manager_class == \"openviking\" and mode != \"middleware\"), \"openviking backend requires memory.mode='middleware'; use OpenViking MCP for tool mode\"","typeGuard":"def openviking_mode_compatible(memory_cfg: dict) -> bool:\n    return memory_cfg.get(\"manager_class\") != \"openviking\" or memory_cfg.get(\"mode\", \"middleware\") == \"middleware\"","tryCatchPattern":null,"preventionTips":["When switching manager_class to openviking, audit the whole memory: block for mode-incompatible settings","Remember the OpenViking division: automatic backend = middleware; explicit tools = OpenViking MCP"],"tags":["openviking","config","memory-mode","validation"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}