microsoft/autogen · error · NotImplementedException
The method or operation is not implemented.
Error message
The method or operation is not implemented.
What it means
NotImplementedException thrown while flattening a MultiModalMessage's content items: the connector only knows how to map TextMessage and ImageMessage items to ChatMessageContentItem. Any other IMessage inside the multimodal payload (e.g. a nested ToolCallMessage or custom type) hits the default switch arm.
Source
Thrown at dotnet/src/AutoGen.OpenAI.V1/Middleware/OpenAIChatRequestMessageConnector.cs:316
}
var imageContentItem = this.CreateChatMessageImageContentItemFromImageMessage(message);
return [new ChatRequestUserMessage([imageContentItem]) { Name = message.From }];
}
private IEnumerable<ChatRequestMessage> ProcessMultiModalMessage(IAgent agent, MultiModalMessage message)
{
if (agent.Name == message.From)
{
// image message from assistant is not supported
throw new ArgumentException("MultiModalMessage is not supported when message.From is the same with agent");
}
IEnumerable<ChatMessageContentItem> items = message.Content.Select<IMessage, ChatMessageContentItem>(ci => ci switch
{
TextMessage text => new ChatMessageTextContentItem(text.Content),
ImageMessage image => this.CreateChatMessageImageContentItemFromImageMessage(image),
_ => throw new NotImplementedException(),
});
return [new ChatRequestUserMessage(items) { Name = message.From }];
}
private ChatMessageImageContentItem CreateChatMessageImageContentItemFromImageMessage(ImageMessage message)
{
return message.Data is null && message.Url is not null
? new ChatMessageImageContentItem(new Uri(message.Url))
: new ChatMessageImageContentItem(message.Data, message.Data?.MediaType);
}
private IEnumerable<ChatRequestMessage> ProcessToolCallMessage(IAgent agent, ToolCallMessage message)
{
if (message.From is not null && message.From != agent.Name)
{
throw new ArgumentException("ToolCallMessage is not supported when message.From is not the same with agent");
}View on GitHub (pinned to 027ecf0a37)
Solutions
- Ensure MultiModalMessage.Content contains only TextMessage and ImageMessage instances
- Pull non-text/image items out and send them as separate messages
- Catch NotImplementedException during prototyping to catch bad payload construction early
Example fix
// before
var mm = new MultiModalMessage(Role.User,
new IMessage[] { text, new ToolCallMessage(...) }); // throws on process
// after
var mm = new MultiModalMessage(Role.User, new IMessage[] { text, image });
// send the tool call separately Defensive patterns
Strategy: validation
Validate before calling
bool valid = multiModal.Content.All(ci => ci is TextMessage or ImageMessage);
if (!valid) { /* strip unsupported items before sending */ } Type guard
static bool ContainsOnlySupportedItems(MultiModalMessage m) => m.Content.All(ci => ci is TextMessage or ImageMessage);
Try / catch
catch (NotImplementedException) { /* split multimodal payload into supported messages and resend */ } Prevention
- Only package TextMessage/ImageMessage inside MultiModalMessage
- Validate payloads in message-factory helpers
When it happens
Trigger: Constructing new MultiModalMessage(Role.User, [textMessage, someOtherMessage]) where someOtherMessage is not TextMessage or ImageMessage, then sending it through the connector.
Common situations: Generic code that packages arbitrary message lists as multimodal content; future-proofing that assumed any IMessage could ride inside a multimodal message.
Related errors
- MultiModalMessage is not supported when message.From is the
- Please set AZURE_OPENAI_API_KEY environment variable.
- Please set AZURE_OPENAI_ENDPOINT environment variable.
- Please set environment variable AZURE_OPENAI_API_KEY
- Invalid aggregate message {reason}
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/88ec1945f77e2d46.
Report an issue: GitHub.