{"record":{"id":"6c7f34f32b1e5675","repo":"FoundationAgents/MetaGPT","slug":"provider-is-not-supported","errorCode":null,"errorMessage":"{provider} is not supported!","messagePattern":"(.+?) is not supported!","errorType":"validation","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"metagpt/provider/bedrock/bedrock_provider.py","lineNumber":207,"sourceCode":"    \"mistral\": MistralProvider,\n    \"meta\": MetaProvider,\n    \"ai21\": Ai21Provider,\n    \"cohere\": CohereProvider,\n    \"anthropic\": AnthropicProvider,\n    \"amazon\": AmazonProvider,\n}\n\n\ndef get_provider(model_id: str, reasoning: bool = False, reasoning_max_token: int = 4000):\n    arr = model_id.split(\".\")\n    if len(arr) == 2:\n        provider, model_name = arr  # meta、mistral……\n    elif len(arr) == 3:\n        # some model_ids may contain country like us.xx.xxx\n        _, provider, model_name = arr\n\n    if provider not in PROVIDERS:\n        raise KeyError(f\"{provider} is not supported!\")\n    if provider == \"meta\":\n        # distinguish llama2 and llama3\n        return PROVIDERS[provider](model_name[:6])\n    elif provider == \"ai21\":\n        # distinguish between j2 and jamba\n        return PROVIDERS[provider](model_name.split(\"-\")[0])\n    elif provider == \"cohere\":\n        # distinguish between R/R+ and older models\n        return PROVIDERS[provider](model_name)\n    return PROVIDERS[provider](reasoning=reasoning, reasoning_max_token=reasoning_max_token)\n","sourceCodeStart":189,"sourceCodeEnd":218,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/provider/bedrock/bedrock_provider.py#L189-L218","documentation":"Bedrock support parses the model_id by splitting on '.': 2 parts (provider.model) or 3 parts (us.provider.model). The extracted provider segment must be a key of the PROVIDERS registry (meta, mistral, ai21, cohere, amazon, anthropic...); otherwise KeyError('{provider} is not supported!') is raised.","triggerScenarios":"model_id like 'xyz.some-model' where xyz is not in PROVIDERS; a model id with a different dot-count (1 part or 4+ parts) causing wrong unpacking; using a Bedrock model name without the provider prefix.","commonSituations":"New Bedrock provider not yet in MetaGPT's registry (older MetaGPT vs new model like an unseen vendor); typos in model_id; region-prefixed ids with unexpected formats.","solutions":["Use a fully qualified Bedrock model id of the form provider.model-name (e.g. 'meta.llama3-8b-instruct-v1:0', 'anthropic.claude-3-sonnet-...').","Check the PROVIDERS dict in metagpt/provider/bedrock/bedrock_provider.py for the providers your MetaGPT version supports.","Upgrade MetaGPT if the provider is newly supported upstream.","As a last resort, register a provider class in PROVIDERS for your vendor following the existing pattern."],"exampleFix":"# before\nllm = LLM(LLMConfig(api_type=\"bedrock\", model=\"llama3-8b\"))  # no provider prefix\n\n# after\nllm = LLM(LLMConfig(api_type=\"bedrock\", model=\"meta.llama3-8b-instruct-v1:0\"))","handlingStrategy":"validation","validationCode":"SUPPORTED_BEDROCK_PROVIDERS = {\"meta\", \"mistral\", \"ai21\", \"cohere\", \"amazon\", \"anthropic\"}\n\ndef bedrock_model_id_ok(model_id: str) -> bool:\n    parts = model_id.split(\".\")\n    provider = parts[-2] if len(parts) in (2, 3) else None\n    return provider in SUPPORTED_BEDROCK_PROVIDERS","typeGuard":null,"tryCatchPattern":"try:\n    provider = get_provider(model_id)\nexcept KeyError as e:\n    raise ValueError(\n        f\"bedrock model_id '{model_id}' unsupported; expected '<provider>.<model>', \"\n        f\"providers: {sorted(SUPPORTED_BEDROCK_PROVIDERS)}\"\n    ) from e","preventionTips":["Store Bedrock model ids as provider-qualified strings from the AWS model listing.","Validate model ids against the PROVIDERS registry in a config unit test."],"tags":["bedrock","aws","model-id","provider-registry"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}