microsoft/semantic-kernel · error · NotSupportedException

Unsupported Anthropic model: {modelId}

Error message

Unsupported Anthropic model: {modelId}

What it means

CreateTextGenerationService routes Anthropic models to AnthropicService only when the model name starts with 'claude-'. Any other Anthropic model name throws NotSupportedException.

Source

Thrown at dotnet/src/Connectors/Connectors.Amazon/Bedrock/Core/BedrockServiceFactory.cs:70

                    return new AI21JambaService();
                }
                if (modelName.StartsWith("j2-", StringComparison.OrdinalIgnoreCase))
                {
                    return new AI21JurassicService();
                }
                throw new NotSupportedException($"Unsupported AI21 model: {modelId}");
            case "AMAZON":
                if (modelName.StartsWith("titan-", StringComparison.OrdinalIgnoreCase))
                {
                    return new AmazonService();
                }
                throw new NotSupportedException($"Unsupported Amazon model: {modelId}");
            case "ANTHROPIC":
                if (modelName.StartsWith("claude-", StringComparison.OrdinalIgnoreCase))
                {
                    return new AnthropicService();
                }
                throw new NotSupportedException($"Unsupported Anthropic model: {modelId}");
            case "COHERE":
                if (modelName.StartsWith("command-r", StringComparison.OrdinalIgnoreCase))
                {
                    return new CohereCommandRService();
                }
                if (modelName.StartsWith("command-", StringComparison.OrdinalIgnoreCase))
                {
                    return new CohereCommandService();
                }
                throw new NotSupportedException($"Unsupported Cohere model: {modelId}");
            case "META":
                if (modelName.StartsWith("llama3-", StringComparison.OrdinalIgnoreCase))
                {
                    return new MetaService();
                }
                throw new NotSupportedException($"Unsupported Meta model: {modelId}");
            case "MISTRAL":
                if (modelName.StartsWith("mistral-", StringComparison.OrdinalIgnoreCase)

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Use an Anthropic Claude modelId such as 'anthropic.claude-3-opus-20240229-v1:0'.
  2. Check the model name starts with 'claude-' exactly.
  3. Upgrade Connectors.Amazon for newer Claude model support.

Example fix

// before
var modelId = "anthropic.claude3-sonnet"; // missing dash -> name does not start with 'claude-'

// after
var modelId = "anthropic.claude-3-sonnet-20240229-v1:0";
Defensive patterns

Strategy: validation

Validate before calling

static bool IsSupportedAnthropicTextModel(string modelId)
{
    var (provider, name) = SplitModelId(modelId);
    return provider.Equals("anthropic", StringComparison.OrdinalIgnoreCase)
        && name.StartsWith("claude-", StringComparison.OrdinalIgnoreCase);
}

Type guard

static bool IsSupportedAnthropicTextModel(string modelId)
{
    var (provider, name) = SplitModelId(modelId);
    return provider.Equals("anthropic", StringComparison.OrdinalIgnoreCase)
        && name.StartsWith("claude-", StringComparison.OrdinalIgnoreCase);
}

Try / catch

try
{
    var text = await bedrockTextGen.GetTextContentAsync(prompt, settings, ct);
}
catch (NotSupportedException ex) when (ex.Message.Contains("Anthropic"))
{
    logger.LogError(ex, "Anthropic modelId '{Id}' not supported. Use claude-*.", modelId);
    throw;
}

Prevention

When it happens

Trigger: Text generation with modelId provider 'anthropic' whose model-name segment does not start with 'claude-' (e.g. a misspelled or non-Claude Anthropic model).

Common situations: Typo in the modelId (e.g. 'anthropic.claude3-opus' missing the dash). Using a non-Claude Anthropic identifier. Outdated connector that doesn't know a newer Claude naming variant.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/c4bca8c1b680414d. Report an issue: GitHub.