microsoft/semantic-kernel · error · NotSupportedException
AI chat service '{config.AIChatService}' is not supported.
Error message
AI chat service '{config.AIChatService}' is not supported. What it means
Error "AI chat service '{config.AIChatService}' is not supported." thrown in microsoft/semantic-kernel.
Source
Thrown at dotnet/samples/Demos/AgentFrameworkWithAspire/ChatWithAgent.ApiService/Program.cs:133
{
builder.AddOpenAIClient(HostConfig.OpenAIConnectionStringName);
}
// Add chat completion services.
switch (config.AIChatService)
{
case AzureOpenAIChatConfig.ConfigSectionName:
{
builder.Services.AddAzureOpenAIChatCompletion(config.AzureOpenAIChat.DeploymentName, modelId: config.AzureOpenAIChat.ModelName);
break;
}
case OpenAIChatConfig.ConfigSectionName:
{
builder.Services.AddOpenAIChatCompletion(config.OpenAIChat.ModelName);
break;
}
default:
throw new NotSupportedException($"AI chat service '{config.AIChatService}' is not supported.");
}
// Add text embedding generation services.
switch (config.Rag.AIEmbeddingService)
{
case AzureOpenAIEmbeddingsConfig.ConfigSectionName:
{
builder.Services.AddAzureOpenAIEmbeddingGenerator(config.AzureOpenAIEmbeddings.DeploymentName, modelId: config.AzureOpenAIEmbeddings.ModelName);
break;
}
case OpenAIEmbeddingsConfig.ConfigSectionName:
{
builder.Services.AddOpenAIEmbeddingGenerator(config.OpenAIEmbeddings.ModelName);
break;
}
default:
throw new NotSupportedException($"AI embeddings service '{config.Rag.AIEmbeddingService}' is not supported.");
}View on GitHub (pinned to c028a0c7dc)
Solutions
- Set AIChatService to one of the supported values in configuration (see Program.cs for accepted names such as OpenAI/AzureOpenAI).
- Correct the AIChatService value in appsettings.json to a supported service type.
When it happens
Trigger: Thrown at dotnet/samples/Demos/AgentFrameworkWithAspire/ChatWithAgent.ApiService/Program.cs:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/aa3b6452d4f87ea1.
Report an issue: GitHub.