mem0ai/mem0 · error · ValueError

Configuration must have a 'model' attribute

Error message

Configuration must have a 'model' attribute

What it means

Error "Configuration must have a 'model' attribute" thrown in mem0ai/mem0.

Source

Thrown at mem0/llms/base.py:36

        """
        if config is None:
            self.config = BaseLlmConfig()
        elif isinstance(config, dict):
            # Handle dict-based configuration (backward compatibility)
            self.config = BaseLlmConfig(**config)
        else:
            self.config = config

        # Validate configuration
        self._validate_config()

    def _validate_config(self):
        """
        Validate the configuration.
        Override in subclasses to add provider-specific validation.
        """
        if not hasattr(self.config, "model"):
            raise ValueError("Configuration must have a 'model' attribute")

    def _is_reasoning_model(self, model: str) -> bool:
        """
        Check if the model is a reasoning model or GPT-5 series that doesn't support certain parameters.

        An explicit ``is_reasoning_model`` on the config takes precedence over the
        name-based heuristic. This lets deployments with custom/versioned model
        names (e.g. Azure ``gpt-5.4-nano-2026-03-17``) opt in or out without
        relying on string matching. When the config value is ``None`` (default),
        classification falls back to the name-based heuristic below.

        Args:
            model: The model name to check

        Returns:
            bool: True if the model is a reasoning model or GPT-5 series
        """
        explicit = getattr(self.config, "is_reasoning_model", None)

View on GitHub (pinned to 001c235229)

Solutions

  1. Pass a proper config object with a 'model' attribute to the LLM constructor.

When it happens

Trigger: Thrown at mem0/llms/base.py:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/fa58cb8b84fc31f4. Report an issue: GitHub.