{"record":{"id":"a007df913f2903ae","repo":"OpenBMB/ChatDev","slug":"mem0memory-requires-a-mem0-memory-store-configurat","errorCode":null,"errorMessage":"Mem0Memory requires a Mem0 memory store configuration","messagePattern":"Mem0Memory requires a Mem0 memory store configuration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"runtime/node/agent/memory/mem0_memory.py","lineNumber":58,"sourceCode":"\nclass Mem0Memory(MemoryBase):\n    \"\"\"Memory store backed by Mem0's managed cloud service.\n\n    Mem0 handles embeddings, storage, and semantic search server-side.\n    No local persistence or embedding computation is needed.\n\n    Important API constraints:\n    - Agent memories use role=\"assistant\" + agent_id\n    - user_id and agent_id are independent scoping dimensions and can be\n      combined in both add() and search() calls.\n    - search() uses filters dict; add() uses top-level kwargs.\n    - SDK returns {\"memories\": [...]} from search.\n    \"\"\"\n\n    def __init__(self, store: MemoryStoreConfig):\n        config = store.as_config(Mem0MemoryConfig)\n        if not config:\n            raise ValueError(\"Mem0Memory requires a Mem0 memory store configuration\")\n        super().__init__(store)\n        self.config = config\n        self.client = _get_mem0_client(config)\n        self.user_id = config.user_id\n        self.agent_id = config.agent_id\n\n    # -------- Persistence (no-ops for cloud-managed store) --------\n\n    def load(self) -> None:\n        \"\"\"No-op: Mem0 manages persistence server-side.\"\"\"\n        pass\n\n    def save(self) -> None:\n        \"\"\"No-op: Mem0 manages persistence server-side.\"\"\"\n        pass\n\n    # -------- Retrieval --------\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/runtime/node/agent/memory/mem0_memory.py#L40-L76","documentation":"Mem0Memory requires the store config to carry a Mem0MemoryConfig section. If store.as_config(Mem0MemoryConfig) is None the config belongs to a different memory backend and the constructor rejects it.","triggerScenarios":"Constructing Mem0Memory with a MemoryStoreConfig whose type is not 'mem0'; mismatch between the configured memory type string and the class instantiated (often via create_memory dispatch).","commonSituations":"Typo in memory.type ('m0', 'mem0ai', wrong case); copying a memory block from another agent template; direct instantiation instead of factory dispatch.","solutions":["Set the store type to 'mem0' in the memory configuration","Use create_memory(store) so the correct class is chosen from the type field","Check for casing/typo issues in the type string"],"exampleFix":"# before\nstore = MemoryStoreConfig(type='simple', ...)\nmem = Mem0Memory(store)\n\n# after\nstore = MemoryStoreConfig(type='mem0', user_id='u1', ...)\nmem = Mem0Memory(store)","handlingStrategy":"validation","validationCode":"cfg = store.as_config(Mem0MemoryConfig)\nif cfg is None:\n    raise ConfigError('store type must be mem0 for Mem0Memory')\nmem = Mem0Memory(store)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use create_memory dispatch","Validate memory.type strings"],"tags":["memory","mem0","configuration","type-mismatch"],"backgroundTag":"config-type-mismatch","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}