microsoft/semantic-kernel · error · NotSupportedException
Unsupported Cohere model: {modelId}
Error message
Unsupported Cohere model: {modelId} What it means
CreateTextGenerationService routes Cohere models to either CohereCommandRService (name starts 'command-r') or CohereCommandService (name starts 'command-'). Any other Cohere model name throws NotSupportedException.
Source
Thrown at dotnet/src/Connectors/Connectors.Amazon/Bedrock/Core/BedrockServiceFactory.cs:80
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)
|| modelName.StartsWith("mixtral-", StringComparison.OrdinalIgnoreCase))
{
return new MistralService();
}
throw new NotSupportedException($"Unsupported Mistral model: {modelId}");
default:
throw new NotSupportedException($"Unsupported model provider: {modelProvider}");
}
}
View on GitHub (pinned to c028a0c7dc)
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.
Example fix
// before - embedding id used for text generation var modelId = "cohere.embed-english-v3:0"; // after var modelId = "cohere.command-r-v1:0";
Defensive patterns
Strategy: validation
Validate before calling
static bool IsSupportedCohereTextModel(string modelId)
{
var (provider, name) = SplitModelId(modelId);
return provider.Equals("cohere", StringComparison.OrdinalIgnoreCase)
&& (name.StartsWith("command-r", StringComparison.OrdinalIgnoreCase)
|| name.StartsWith("command-", StringComparison.OrdinalIgnoreCase));
} Type guard
static bool IsSupportedCohereTextModel(string modelId)
{
var (provider, name) = SplitModelId(modelId);
return provider.Equals("cohere", StringComparison.OrdinalIgnoreCase)
&& (name.StartsWith("command-r", StringComparison.OrdinalIgnoreCase)
|| name.StartsWith("command-", StringComparison.OrdinalIgnoreCase));
} Try / catch
try
{
var text = await bedrockTextGen.GetTextContentAsync(prompt, settings, ct);
}
catch (NotSupportedException ex) when (ex.Message.Contains("Cohere"))
{
logger.LogError(ex, "Cohere modelId '{Id}' not supported for text generation. Use command-*.", modelId);
throw;
} Prevention
- 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.
When it happens
Trigger: 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').
Common situations: Using a Cohere embedding model id for a text-generation call. Wrong modelId. A Cohere model family not yet supported by this connector version.
Related errors
- Unsupported AI21 model: {modelId}
- Unsupported Amazon model: {modelId}
- Unsupported Anthropic model: {modelId}
- Unsupported Meta model: {modelId}
- Unsupported Mistral model: {modelId}
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/b0d190f87fc4398b.
Report an issue: GitHub.