OpenBMB/ChatDev · error · ValueError

Mem0Memory requires a Mem0 memory store configuration

Error message

Mem0Memory requires a Mem0 memory store configuration

What it means

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.

Source

Thrown at runtime/node/agent/memory/mem0_memory.py:58

class Mem0Memory(MemoryBase):
    """Memory store backed by Mem0's managed cloud service.

    Mem0 handles embeddings, storage, and semantic search server-side.
    No local persistence or embedding computation is needed.

    Important API constraints:
    - Agent memories use role="assistant" + agent_id
    - user_id and agent_id are independent scoping dimensions and can be
      combined in both add() and search() calls.
    - search() uses filters dict; add() uses top-level kwargs.
    - SDK returns {"memories": [...]} from search.
    """

    def __init__(self, store: MemoryStoreConfig):
        config = store.as_config(Mem0MemoryConfig)
        if not config:
            raise ValueError("Mem0Memory requires a Mem0 memory store configuration")
        super().__init__(store)
        self.config = config
        self.client = _get_mem0_client(config)
        self.user_id = config.user_id
        self.agent_id = config.agent_id

    # -------- Persistence (no-ops for cloud-managed store) --------

    def load(self) -> None:
        """No-op: Mem0 manages persistence server-side."""
        pass

    def save(self) -> None:
        """No-op: Mem0 manages persistence server-side."""
        pass

    # -------- Retrieval --------

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Set the store type to 'mem0' in the memory configuration
  2. Use create_memory(store) so the correct class is chosen from the type field
  3. Check for casing/typo issues in the type string

Example fix

# before
store = MemoryStoreConfig(type='simple', ...)
mem = Mem0Memory(store)

# after
store = MemoryStoreConfig(type='mem0', user_id='u1', ...)
mem = Mem0Memory(store)
Defensive patterns

Strategy: validation

Validate before calling

cfg = store.as_config(Mem0MemoryConfig)
if cfg is None:
    raise ConfigError('store type must be mem0 for Mem0Memory')
mem = Mem0Memory(store)

Prevention

When it happens

Trigger: 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).

Common situations: Typo in memory.type ('m0', 'mem0ai', wrong case); copying a memory block from another agent template; direct instantiation instead of factory dispatch.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/a007df913f2903ae. Report an issue: GitHub.