microsoft/autogen · error · ArgumentException
MultiModalMessage is not supported when message.From is the
Error message
MultiModalMessage is not supported when message.From is the same with agent
What it means
Error "MultiModalMessage is not supported when message.From is the same with agent" thrown in microsoft/autogen.
Source
Thrown at dotnet/src/AutoGen.AzureAIInference/Middleware/AzureAIInferenceChatRequestMessageConnector.cs:237
private IEnumerable<ChatRequestMessage> ProcessImageMessage(IAgent agent, ImageMessage message)
{
if (agent.Name == message.From)
{
// image message from assistant is not supported
throw new ArgumentException("ImageMessage is not supported when message.From is the same with agent");
}
var imageContentItem = this.CreateChatMessageImageContentItemFromImageMessage(message);
return [new ChatRequestUserMessage([imageContentItem])];
}
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)];
}
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);
}View on GitHub (pinned to 027ecf0a37)
Solutions
- Multi-modal content is only supported for user messages
Example fix
Send multimodal content only in messages from the user
When it happens
Trigger: Thrown at dotnet/src/AutoGen.AzureAIInference/Middleware/AzureAIInferenceChatRequestMessageConnector.cs:237 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/a078675ecb5228fb.
Report an issue: GitHub.