FoundationAgents/MetaGPT · error · KeyError

{provider} is not supported!

Error message

{provider} is not supported!

What it means

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.

Source

Thrown at metagpt/provider/bedrock/bedrock_provider.py:207

    "mistral": MistralProvider,
    "meta": MetaProvider,
    "ai21": Ai21Provider,
    "cohere": CohereProvider,
    "anthropic": AnthropicProvider,
    "amazon": AmazonProvider,
}


def get_provider(model_id: str, reasoning: bool = False, reasoning_max_token: int = 4000):
    arr = model_id.split(".")
    if len(arr) == 2:
        provider, model_name = arr  # meta、mistral……
    elif len(arr) == 3:
        # some model_ids may contain country like us.xx.xxx
        _, provider, model_name = arr

    if provider not in PROVIDERS:
        raise KeyError(f"{provider} is not supported!")
    if provider == "meta":
        # distinguish llama2 and llama3
        return PROVIDERS[provider](model_name[:6])
    elif provider == "ai21":
        # distinguish between j2 and jamba
        return PROVIDERS[provider](model_name.split("-")[0])
    elif provider == "cohere":
        # distinguish between R/R+ and older models
        return PROVIDERS[provider](model_name)
    return PROVIDERS[provider](reasoning=reasoning, reasoning_max_token=reasoning_max_token)

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. 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-...').
  2. Check the PROVIDERS dict in metagpt/provider/bedrock/bedrock_provider.py for the providers your MetaGPT version supports.
  3. Upgrade MetaGPT if the provider is newly supported upstream.
  4. As a last resort, register a provider class in PROVIDERS for your vendor following the existing pattern.

Example fix

# before
llm = LLM(LLMConfig(api_type="bedrock", model="llama3-8b"))  # no provider prefix

# after
llm = LLM(LLMConfig(api_type="bedrock", model="meta.llama3-8b-instruct-v1:0"))
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_BEDROCK_PROVIDERS = {"meta", "mistral", "ai21", "cohere", "amazon", "anthropic"}

def bedrock_model_id_ok(model_id: str) -> bool:
    parts = model_id.split(".")
    provider = parts[-2] if len(parts) in (2, 3) else None
    return provider in SUPPORTED_BEDROCK_PROVIDERS

Try / catch

try:
    provider = get_provider(model_id)
except KeyError as e:
    raise ValueError(
        f"bedrock model_id '{model_id}' unsupported; expected '<provider>.<model>', "
        f"providers: {sorted(SUPPORTED_BEDROCK_PROVIDERS)}"
    ) from e

Prevention

When it happens

Trigger: 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.

Common situations: 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.


AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14). Data as JSON: /api/errors/6c7f34f32b1e5675. Report an issue: GitHub.