microsoft/autogen · error · NotImplementedException
The method or operation is not implemented.
Error message
The method or operation is not implemented.
What it means
While flattening a MultiModalMessage's content parts into OpenAI ChatMessageContentParts, ProcessMultiModalMessage only knows TextMessage and ImageMessage. Any other IMessage inside the multimodal collection (e.g. a ToolCallMessage or AudioMessage) hits the default arm and throws NotImplementedException.
Source
Thrown at dotnet/src/AutoGen.OpenAI/Middleware/OpenAIChatRequestMessageConnector.cs:289
}
var imageContentItem = this.CreateChatMessageImageContentItemFromImageMessage(message);
return [new UserChatMessage([imageContentItem]) { ParticipantName = message.From }];
}
private IEnumerable<ChatMessage> 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<ChatMessageContentPart> items = message.Content.Select<IMessage, ChatMessageContentPart>(ci => ci switch
{
TextMessage text => ChatMessageContentPart.CreateTextPart(text.Content),
ImageMessage image => this.CreateChatMessageImageContentItemFromImageMessage(image),
_ => throw new NotImplementedException(),
});
return [new UserChatMessage(items) { ParticipantName = message.From }];
}
private ChatMessageContentPart CreateChatMessageImageContentItemFromImageMessage(ImageMessage message)
{
return message.Data is null && message.Url is not null
? ChatMessageContentPart.CreateImagePart(new Uri(message.Url))
: ChatMessageContentPart.CreateImagePart(message.Data, message.Data?.MediaType);
}
private IEnumerable<ChatMessage> 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.
- Filter or project the content before constructing the message: drop tool-call messages or serialize them into a TextMessage.
- Wrap custom payloads as text (e.g. JSON in a TextMessage) instead of embedding non-media IMessage types.
Example fix
// before
var items = new IMessage[] { new TextMessage(Role.User, "describe"), someToolCallMessage };
var mm = new MultiModalMessage(Role.User, items);
// after
var items = new IMessage[] { new TextMessage(Role.User, "describe"), imageMessage };
var mm = new MultiModalMessage(Role.User, items); Defensive patterns
Strategy: type-guard
Validate before calling
// Validate multimodal content before constructing the message
if (items.Any(i => i is not (TextMessage or ImageMessage)))
throw new ArgumentException("MultiModalMessage.Content supports only TextMessage and ImageMessage."); Type guard
static bool IsValidMultimodalContent(IEnumerable<IMessage> items) =>
items.All(i => i is TextMessage or ImageMessage); Try / catch
catch (NotImplementedException) when (inMultimodalConversion)
{
logger.LogError("Non text/image item in MultiModalMessage");
throw;
} Prevention
- Always build multimodal content via a helper that only accepts TextMessage/ImageMessage.
- Stringify tool-call or custom payloads into TextMessage before mixing into multimodal turns.
When it happens
Trigger: Constructing MultiModalMessage with a content collection containing something other than TextMessage/ImageMessage, then sending it through the connector.
Common situations: Programmatically building multimodal content by mapping over a mixed message list; adding tool-call or custom message types into what was assumed to be a text+image list.
Related errors
- Invalid message type: {m.GetType().Name}
- Invalid Role
- MultiModalMessage is not supported when message.From is the
- Unsupported message type: {item.GetType().Name}
- Only one choice is supported in streaming response
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/1f0d3739e0350a13.
Report an issue: GitHub.