{"record":{"id":"74a2aaab87134dbb","repo":"mem0ai/mem0","slug":"unsupported-llm-provider-provider-name","errorCode":null,"errorMessage":"Unsupported Llm provider: {provider_name}","messagePattern":"Unsupported Llm provider: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/utils/factory.py","lineNumber":80,"sourceCode":"\n    @classmethod\n    def create(cls, provider_name: str, config: Optional[Union[BaseLlmConfig, Dict]] = None, **kwargs):\n        \"\"\"\n        Create an LLM instance with the appropriate configuration.\n\n        Args:\n            provider_name (str): The provider name (e.g., 'openai', 'anthropic')\n            config: Configuration object or dict. If None, will create default config\n            **kwargs: Additional configuration parameters\n\n        Returns:\n            Configured LLM instance\n\n        Raises:\n            ValueError: If provider is not supported\n        \"\"\"\n        if provider_name not in cls.provider_to_class:\n            raise ValueError(f\"Unsupported Llm provider: {provider_name}\")\n\n        class_type, config_class = cls.provider_to_class[provider_name]\n        llm_class = load_class(class_type)\n\n        # Handle configuration\n        if config is None:\n            # Create default config with kwargs\n            config = config_class(**kwargs)\n        elif isinstance(config, dict):\n            # Merge dict config with kwargs\n            config = {**config, **kwargs}\n            config = config_class(**config)\n        elif isinstance(config, BaseLlmConfig):\n            # Convert base config to provider-specific config if needed\n            if config_class != BaseLlmConfig:\n                # Convert to provider-specific config\n                config_dict = {\n                    \"model\": config.model,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/utils/factory.py#L62-L98","documentation":"Thrown by LlmFactory.create when the provider_name string is not a key in LlmFactory.provider_to_class. Mem0 only instantiates LLM backends registered in this dict (openai, anthropic, azure_openai, gemini, groq, together, deepseek, minimax, xai, ollama, lmstudio, vllm, litellm, aws_bedrock, sarvam, langchain, and the *_structured variants), so any other string is rejected before any client is built.","triggerScenarios":"Calling Memory.from_config() with config.dict({'llm': {'provider': '<name>'}}) where <name> is misspelled or unregistered; passing MemoryConfig(llm={'provider': 'azure'}) instead of 'azure_openai'; passing 'gpt-4o' (a model name) instead of a provider name; calling LlmFactory.create('claude') instead of 'anthropic'.","commonSituations":"Typo in the provider key in a YAML/JSON config; using a model name where a provider name is expected; using a provider name that exists in the hosted platform but not in the OSS factory (e.g. 'azure' vs 'azure_openai', 'vertexai' vs the registered names); case sensitivity ('OpenAI' vs 'openai').","solutions":["Fix the provider string to an exact key of LlmFactory.provider_to_class — check with LlmFactory.get_supported_providers()","For Azure OpenAI use 'azure_openai' (or 'azure_openai_structured'), for Anthropic use 'anthropic', for AWS use 'aws_bedrock'","For a provider mem0 does not ship, route it through the 'litellm' or 'langchain' provider instead of an unsupported name","For a custom class, call LlmFactory.register_provider(name, class_path, config_class) before create()"],"exampleFix":"// before\nconfig = {\n  \"llm\": {\"provider\": \"azure\", \"model\": \"gpt-4o\", \"config\": {...}}\n}\nmemory = Memory.from_config(config)\n\n# after\nconfig = {\n  \"llm\": {\"provider\": \"azure_openai\", \"model\": \"gpt-4o\", \"config\": {...}}\n}\nmemory = Memory.from_config(config)","handlingStrategy":"validation","validationCode":"from mem0.utils.factory import LlmFactory\nprovider = cfg['llm']['provider']\nif provider not in LlmFactory.provider_to_class:\n    raise ConfigError(f\"unknown llm provider {provider!r}; valid: {LlmFactory.get_supported_providers()}\")","typeGuard":"def is_known_llm_provider(p: str) -> bool:\n    from mem0.utils.factory import LlmFactory\n    return isinstance(p, str) and p in LlmFactory.provider_to_class","tryCatchPattern":"try:\n    memory = Memory.from_config(config)\nexcept ValueError as e:\n    if 'Unsupported Llm provider' in str(e):\n        raise ConfigError(str(e)) from e\n    raise","preventionTips":["Validate provider keys against LlmFactory.provider_to_class before building config","Keep provider names in one constant/config module instead of scattering string literals","Write a startup config-schema check (fail fast at boot, not at first memory.add)","Pin the mem0ai version so the provider registry cannot silently change under you"],"tags":["configuration","llm-provider","factory","validation"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}