{"record":{"id":"b0d190f87fc4398b","repo":"microsoft/semantic-kernel","slug":"unsupported-cohere-model-modelid","errorCode":null,"errorMessage":"Unsupported Cohere model: {modelId}","messagePattern":"Unsupported Cohere model: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.Amazon/Bedrock/Core/BedrockServiceFactory.cs","lineNumber":80,"sourceCode":"                    return new AmazonService();\n                }\n                throw new NotSupportedException($\"Unsupported Amazon model: {modelId}\");\n            case \"ANTHROPIC\":\n                if (modelName.StartsWith(\"claude-\", StringComparison.OrdinalIgnoreCase))\n                {\n                    return new AnthropicService();\n                }\n                throw new NotSupportedException($\"Unsupported Anthropic model: {modelId}\");\n            case \"COHERE\":\n                if (modelName.StartsWith(\"command-r\", StringComparison.OrdinalIgnoreCase))\n                {\n                    return new CohereCommandRService();\n                }\n                if (modelName.StartsWith(\"command-\", StringComparison.OrdinalIgnoreCase))\n                {\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","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.Amazon/Bedrock/Core/BedrockServiceFactory.cs#L62-L98","documentation":"CreateTextGenerationService routes Cohere models to either CohereCommandRService (name starts 'command-r') or CohereCommandService (name starts 'command-'). Any other Cohere model name throws NotSupportedException.","triggerScenarios":"Text generation with modelId provider 'cohere' whose model-name segment starts with neither 'command-r' nor 'command-' (e.g. 'cohere.embed-multilingual-v3' used for text generation, or 'cohere.some-other-model').","commonSituations":"Using a Cohere embedding model id for a text-generation call. Wrong modelId. A Cohere model family not yet supported by this connector version.","solutions":["Use a Cohere Command modelId for text generation, e.g. 'cohere.command-r-v1:0' or 'cohere.command-light-v1'.","Ensure you are using the text-generation service, not the embedding service, for Command models.","Upgrade Connectors.Amazon for newer Cohere support."],"exampleFix":"// before - embedding id used for text generation\nvar modelId = \"cohere.embed-english-v3:0\";\n\n// after\nvar modelId = \"cohere.command-r-v1:0\";","handlingStrategy":"validation","validationCode":"static bool IsSupportedCohereTextModel(string modelId)\n{\n    var (provider, name) = SplitModelId(modelId);\n    return provider.Equals(\"cohere\", StringComparison.OrdinalIgnoreCase)\n        && (name.StartsWith(\"command-r\", StringComparison.OrdinalIgnoreCase)\n            || name.StartsWith(\"command-\", StringComparison.OrdinalIgnoreCase));\n}","typeGuard":"static bool IsSupportedCohereTextModel(string modelId)\n{\n    var (provider, name) = SplitModelId(modelId);\n    return provider.Equals(\"cohere\", StringComparison.OrdinalIgnoreCase)\n        && (name.StartsWith(\"command-r\", StringComparison.OrdinalIgnoreCase)\n            || name.StartsWith(\"command-\", StringComparison.OrdinalIgnoreCase));\n}","tryCatchPattern":"try\n{\n    var text = await bedrockTextGen.GetTextContentAsync(prompt, settings, ct);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Cohere\"))\n{\n    logger.LogError(ex, \"Cohere modelId '{Id}' not supported for text generation. Use command-*.\", modelId);\n    throw;\n}","preventionTips":["Use Cohere Command ids for text generation, not Cohere embedding ids.","Validate the model prefix against the supported list per modality.","Upgrade the connector for newer Cohere support."],"tags":["csharp","dotnet","semantic-kernel","bedrock","aws","cohere","model-id","not-supported"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}