microsoft/semantic-kernel · error · NotSupportedException

Unsupported model provider: {modelProvider}

Error message

Unsupported model provider: {modelProvider}

What it means

CreateTextGenerationService falls to the default case when the provider segment (before the first dot) is not one of AI21, AMAZON, ANTHROPIC, COHERE, META, or MISTRAL. It throws NotSupportedException naming the unrecognized provider.

Source

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

                {
                    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)
                    || modelName.StartsWith("mixtral-", StringComparison.OrdinalIgnoreCase))
                {
                    return new MistralService();
                }
                throw new NotSupportedException($"Unsupported Mistral model: {modelId}");
            default:
                throw new NotSupportedException($"Unsupported model provider: {modelProvider}");
        }
    }

    /// <summary>
    /// Gets the model service for body conversion.
    /// </summary>
    /// <param name="modelId">The model to get the service for.</param>
    /// <returns><see cref="IBedrockChatCompletionService"/> object</returns>
    /// <exception cref="NotSupportedException">Thrown if provider or model is not supported for chat completion.</exception>
    internal IBedrockChatCompletionService CreateChatCompletionService(string modelId)
    {
        (string modelProvider, string modelName) = this.GetModelProviderAndName(ScrubCrossRegionPrefix(modelId));

        switch (modelProvider.ToUpperInvariant())
        {
            case "AI21":
                if (modelName.StartsWith("jamba", StringComparison.OrdinalIgnoreCase))
                {

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Use a modelId from a supported provider: 'amazon.*', 'anthropic.*', 'cohere.*', 'meta.*', 'mistral.*', or 'ai21.*' with a supported model name.
  2. Ensure the modelId contains a dot separating provider and model name.
  3. Confirm the model is a text-generation model, not an embedding/image model.
  4. Upgrade Connectors.Amazon if the provider should be supported in a newer version.

Example fix

// before - no dot, whole id becomes provider
var modelId = "titan-text-premier-v1:0";
// provider='titan-text-premier-v1:0' -> Unsupported model provider

// after
var modelId = "amazon.titan-text-premier-v1:0";
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<string> s_textProviders = new(StringComparer.OrdinalIgnoreCase)
    { "ai21", "amazon", "anthropic", "cohere", "meta", "mistral" };

static bool HasKnownTextProvider(string modelId)
{
    var idx = modelId.IndexOf('.');
    if (idx <= 0) return false; // no dot -> whole id is provider
    return s_textProviders.Contains(modelId[..idx]);
}

Type guard

static bool HasKnownTextProvider(string modelId)
{
    var idx = modelId.IndexOf('.');
    if (idx <= 0) return false;
    return new[] { "ai21", "amazon", "anthropic", "cohere", "meta", "mistral" }
        .Contains(modelId[..idx], StringComparer.OrdinalIgnoreCase);
}

Try / catch

try
{
    var text = await bedrockTextGen.GetTextContentAsync(prompt, settings, ct);
}
catch (NotSupportedException ex) when (ex.Message.Contains("model provider"))
{
    logger.LogError(ex, "Provider not supported for text generation. Check modelId format 'provider.model'.");
    throw;
}

Prevention

When it happens

Trigger: Text generation with a modelId whose provider segment is unknown (e.g. 'stability.stable-diffusion-xl', 'unknown.foo'), or a modelId missing the dot delimiter entirely (so the whole string becomes the provider and the name is empty).

Common situations: Passing an image/embedding model id to a text-generation call. Typo in the provider prefix. A modelId with no dot (GetModelProviderAndName treats the entire string as the provider and the name as empty). Using a provider the connector doesn't support at all.

Related errors


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