microsoft/autogen · error · ValueError

config is required when using local Mem0 client (is_cloud=Fa

Error message

config is required when using local Mem0 client (is_cloud=False)

What it means

Mem0Memory supports two modes: cloud (MemoryClient with api_key) and local (Memory from the mem0ai package configured via a dict). The local client needs connection/embedding/LLM settings, so constructing Mem0Memory with is_cloud=False and config=None raises ValueError immediately in __init__.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/memory/mem0/_mem0.py:176

        api_key: API key for cloud Mem0 client. It will read from the environment MEM0_API_KEY if not provided.
        config: Configuration dictionary for local Mem0 client. Required if is_cloud=False.
    """

    component_type = "memory"
    component_provider_override = "autogen_ext.memory.mem0.Mem0Memory"
    component_config_schema = Mem0MemoryConfig

    def __init__(
        self,
        user_id: Optional[str] = None,
        limit: int = 10,
        is_cloud: bool = True,
        api_key: Optional[str] = None,
        config: Optional[Dict[str, Any]] = None,
    ) -> None:
        # Validate parameters
        if not is_cloud and config is None:
            raise ValueError("config is required when using local Mem0 client (is_cloud=False)")

        # Initialize instance variables
        self._user_id = user_id or str(uuid.uuid4())
        self._limit = limit
        self._is_cloud = is_cloud
        self._api_key = api_key
        self._config = config

        # Initialize client
        if self._is_cloud:
            self._client = MemoryClient(api_key=self._api_key)
        else:
            assert self._config is not None
            config_dict = self._config
            self._client = Memory0.from_config(config_dict=config_dict)  # type: ignore

    @property
    def user_id(self) -> str:

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Provide a config dict for the local client, e.g. Mem0Memory(is_cloud=False, config={'embedder': {'provider': 'openai', 'config': {'api_key': ...}}, 'llm': {...}, 'vector_store': {...}}).
  2. If you meant to use Mem0 cloud, keep is_cloud=True (default) and pass api_key.
  3. Validate config presence at startup when is_cloud comes from an environment variable.

Example fix

# before
memory = Mem0Memory(is_cloud=False)  # ValueError

# after
memory = Mem0Memory(
    is_cloud=False,
    config={
        'vector_store': {'provider': 'chroma', 'config': {'path': './mem0-store'}},
        'llm': {'provider': 'openai', 'config': {'model': 'gpt-4o-mini'}},
        'embedder': {'provider': 'openai', 'config': {'model': 'text-embedding-3-small'}},
    },
)
Defensive patterns

Strategy: validation

Validate before calling

def build_mem0(is_cloud: bool, api_key=None, config=None):
    if not is_cloud and config is None:
        raise ValueError('local Mem0 requires a config dict; check MEM0_* env vars')
    return Mem0Memory(is_cloud=is_cloud, api_key=api_key, config=config)

Prevention

When it happens

Trigger: Mem0Memory(is_cloud=False) with no config kwarg; passing is_cloud=False but forgetting that the local mode requires a config dict; copying a cloud example and only flipping is_cloud.

Common situations: Migrating from Mem0 cloud to self-hosted mem0 and dropping the api_key without adding local settings; env-driven config where an unset MEM0_CONFIG leaves config=None while is_cloud defaults get flipped; version upgrades renaming the parameter.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/d7e390826cea9add. Report an issue: GitHub.