microsoft/autogen · error · NotSupportedException
Role {textMessage.Role} is not supported
Error message
Role {textMessage.Role} is not supported What it means
Error "Role {textMessage.Role} is not supported" thrown in microsoft/autogen.
Source
Thrown at dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs:175
{
if (textMessage.Role == Role.User)
{
messages = new ChatMessage(
"user", textMessage.Content);
}
else if (textMessage.Role == Role.Assistant)
{
messages = new ChatMessage(
"assistant", textMessage.Content);
}
else if (textMessage.Role == Role.System)
{
messages = new ChatMessage(
"system", textMessage.Content);
}
else
{
throw new NotSupportedException($"Role {textMessage.Role} is not supported");
}
}
else
{
// if from is not null, then the message is from user
messages = new ChatMessage(
"user", textMessage.Content);
}
return [new MessageEnvelope<ChatMessage>(messages, from: textMessage.From)];
}
private async Task<IEnumerable<IMessage>> ProcessMultiModalMessageAsync(MultiModalMessage multiModalMessage, IAgent agent)
{
var content = new List<ContentBase>();
foreach (var message in multiModalMessage.Content)
{
switch (message)View on GitHub (pinned to 027ecf0a37)
Solutions
- Use only user/assistant roles; convert system messages to system parameter
Example fix
Map Role.System to the system prompt and drop other unsupported roles
When it happens
Trigger: Thrown at dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs:175 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/b44428d394204700.
Report an issue: GitHub.