{"record":{"id":"6f98d3d6fc595396","repo":"microsoft/semantic-kernel","slug":"unsupported-model-provider-modelprovider","errorCode":null,"errorMessage":"Unsupported model provider: {modelProvider}","messagePattern":"Unsupported model provider: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.Amazon/Bedrock/Core/BedrockServiceFactory.cs","lineNumber":95,"sourceCode":"                {\n                    return new CohereCommandService();\n                }\n                throw new NotSupportedException($\"Unsupported Cohere model: {modelId}\");\n            case \"META\":\n                if (modelName.StartsWith(\"llama3-\", StringComparison.OrdinalIgnoreCase))\n                {\n                    return new MetaService();\n                }\n                throw new NotSupportedException($\"Unsupported Meta model: {modelId}\");\n            case \"MISTRAL\":\n                if (modelName.StartsWith(\"mistral-\", StringComparison.OrdinalIgnoreCase)\n                    || modelName.StartsWith(\"mixtral-\", StringComparison.OrdinalIgnoreCase))\n                {\n                    return new MistralService();\n                }\n                throw new NotSupportedException($\"Unsupported Mistral model: {modelId}\");\n            default:\n                throw new NotSupportedException($\"Unsupported model provider: {modelProvider}\");\n        }\n    }\n\n    /// <summary>\n    /// Gets the model service for body conversion.\n    /// </summary>\n    /// <param name=\"modelId\">The model to get the service for.</param>\n    /// <returns><see cref=\"IBedrockChatCompletionService\"/> object</returns>\n    /// <exception cref=\"NotSupportedException\">Thrown if provider or model is not supported for chat completion.</exception>\n    internal IBedrockChatCompletionService CreateChatCompletionService(string modelId)\n    {\n        (string modelProvider, string modelName) = this.GetModelProviderAndName(ScrubCrossRegionPrefix(modelId));\n\n        switch (modelProvider.ToUpperInvariant())\n        {\n            case \"AI21\":\n                if (modelName.StartsWith(\"jamba\", StringComparison.OrdinalIgnoreCase))\n                {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.Amazon/Bedrock/Core/BedrockServiceFactory.cs#L77-L113","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use a modelId from a supported provider: 'amazon.*', 'anthropic.*', 'cohere.*', 'meta.*', 'mistral.*', or 'ai21.*' with a supported model name.","Ensure the modelId contains a dot separating provider and model name.","Confirm the model is a text-generation model, not an embedding/image model.","Upgrade Connectors.Amazon if the provider should be supported in a newer version."],"exampleFix":"// before - no dot, whole id becomes provider\nvar modelId = \"titan-text-premier-v1:0\";\n// provider='titan-text-premier-v1:0' -> Unsupported model provider\n\n// after\nvar modelId = \"amazon.titan-text-premier-v1:0\";","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> s_textProviders = new(StringComparer.OrdinalIgnoreCase)\n    { \"ai21\", \"amazon\", \"anthropic\", \"cohere\", \"meta\", \"mistral\" };\n\nstatic bool HasKnownTextProvider(string modelId)\n{\n    var idx = modelId.IndexOf('.');\n    if (idx <= 0) return false; // no dot -> whole id is provider\n    return s_textProviders.Contains(modelId[..idx]);\n}","typeGuard":"static bool HasKnownTextProvider(string modelId)\n{\n    var idx = modelId.IndexOf('.');\n    if (idx <= 0) return false;\n    return new[] { \"ai21\", \"amazon\", \"anthropic\", \"cohere\", \"meta\", \"mistral\" }\n        .Contains(modelId[..idx], StringComparer.OrdinalIgnoreCase);\n}","tryCatchPattern":"try\n{\n    var text = await bedrockTextGen.GetTextContentAsync(prompt, settings, ct);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"model provider\"))\n{\n    logger.LogError(ex, \"Provider not supported for text generation. Check modelId format 'provider.model'.\");\n    throw;\n}","preventionTips":["Always format modelId as 'provider.model-name'.","Use only supported providers for the modality you are calling.","Do not pass embedding/image model ids to text-generation calls."],"tags":["csharp","dotnet","semantic-kernel","bedrock","aws","model-id","not-supported","provider"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}