{"record":{"id":"8d8ed627035cc55a","repo":"mem0ai/mem0","slug":"unknown-provider-override-explicit-provider-v","errorCode":null,"errorMessage":"Unknown provider_override '{explicit_provider}'. Valid providers: {', '.join(PROVIDERS)}","messagePattern":"Unknown provider_override '(.+?)'\\. Valid providers: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/llms/aws_bedrock.py","lineNumber":30,"sourceCode":"from mem0.configs.llms.aws_bedrock import AWSBedrockConfig\nfrom mem0.configs.llms.base import BaseLlmConfig\nfrom mem0.llms.base import LLMBase\nfrom mem0.memory.utils import extract_json\n\nlogger = logging.getLogger(__name__)\n\nPROVIDERS = [\n    \"ai21\", \"amazon\", \"anthropic\", \"cohere\", \"meta\", \"mistral\", \"stability\", \"writer\",\n    \"deepseek\", \"gpt-oss\", \"perplexity\", \"snowflake\", \"titan\", \"command\", \"j2\", \"llama\",\n    \"minimax\",\n]\n\n\ndef extract_provider(model: str, explicit_provider: Optional[str] = None) -> str:\n    \"\"\"Extract provider from model identifier, or return explicit_provider when set.\"\"\"\n    if explicit_provider:\n        if explicit_provider not in PROVIDERS:\n            raise ValueError(\n                f\"Unknown provider_override '{explicit_provider}'. Valid providers: {', '.join(PROVIDERS)}\"\n            )\n        return explicit_provider\n    for provider in PROVIDERS:\n        if re.search(rf\"\\b{re.escape(provider)}\\b\", model):\n            return provider\n    raise ValueError(f\"Unknown provider in model: {model}\")\n\n\nclass AWSBedrockLLM(LLMBase):\n    \"\"\"\n    AWS Bedrock LLM integration for Mem0.\n\n    Supports all available Bedrock models with automatic provider detection.\n    \"\"\"\n\n    def __init__(self, config: Optional[Union[AWSBedrockConfig, BaseLlmConfig, Dict]] = None):\n        \"\"\"","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/llms/aws_bedrock.py#L12-L48","documentation":"Raised by extract_provider() when config.provider_override (or the explicit_provider argument) is set to a string not in the module's PROVIDERS allowlist (ai21, amazon, anthropic, cohere, meta, mistral, stability, writer, deepseek, gpt-oss, perplexity, snowflake, titan, command, j2, llama, minimax). The override exists to disambiguate model IDs; an unrecognized value is rejected before any AWS call.","triggerScenarios":"Setting provider_override: \"Anthropic\" (wrong case), \"bedrock\", \"openai\", or a typo like \"anthrpoic\" in the LLM config; passing an unsupported new provider name before this mem0 version's allowlist includes it.","commonSituations":"Copy-pasting provider names from AWS console ARNs; case-sensitive mismatch; expecting a provider added in a newer mem0 release while running an older one.","solutions":["Use the exact lowercase provider key from the error message's valid list (e.g. anthropic, amazon, mistral)","Remove provider_override entirely and let automatic detection infer the provider from the model ID prefix","Upgrade mem0ai if the provider you need was added in a later version of the allowlist"],"exampleFix":"// before\n{\"llm\": {\"provider\": \"aws_bedrock\", \"config\": {\"model\": \"anthropic.claude-3-5-sonnet-20240620-v1:0\", \"provider_override\": \"Anthropic\"}}}  # ValueError\n\n# after\n{\"llm\": {\"provider\": \"aws_bedrock\", \"config\": {\"model\": \"anthropic.claude-3-5-sonnet-20240620-v1:0\", \"provider_override\": \"anthropic\"}}}","handlingStrategy":"validation","validationCode":"PROVIDERS = {\"ai21\",\"amazon\",\"anthropic\",\"cohere\",\"meta\",\"mistral\",\"stability\",\"writer\",\n             \"deepseek\",\"gpt-oss\",\"perplexity\",\"snowflake\",\"titan\",\"command\",\"j2\",\"llama\",\"minimax\"}\noverride = llm_config.get(\"provider_override\")\nif override is not None:\n    assert override.lower() in PROVIDERS, f\"provider_override must be one of {sorted(PROVIDERS)}\"","typeGuard":"PROVIDERS = {\"ai21\",\"amazon\",\"anthropic\",\"cohere\",\"meta\",\"mistral\",\"stability\",\"writer\",\n             \"deepseek\",\"gpt-oss\",\"perplexity\",\"snowflake\",\"titan\",\"command\",\"j2\",\"llama\",\"minimax\"}\n\ndef is_valid_provider_override(p: str) -> bool:\n    return p in PROVIDERS","tryCatchPattern":"try:\n    llm = AWSBedrockLLM(config)\nexcept ValueError as e:\n    if \"provider_override\" in str(e):\n        config[\"provider_override\"] = config[\"provider_override\"].lower()\n        llm = AWSBedrockLLM(config)  # retry with normalized casing\n    else:\n        raise","preventionTips":["Use exact lowercase provider keys","Omit provider_override unless detection actually fails","Re-check the allowlist after upgrading mem0ai"],"tags":["python","aws","bedrock","validation","config","mem0"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}