{"record":{"id":"eb2b8c3f29802e00","repo":"microsoft/autogen","slug":"multimodalmessage-is-not-supported-when-message-fr-eb2b8c","errorCode":null,"errorMessage":"MultiModalMessage is not supported when message.From is the same with agent","messagePattern":"MultiModalMessage is not supported when message\\.From is the same with agent","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.OpenAI.V1/Middleware/OpenAIChatRequestMessageConnector.cs","lineNumber":309,"sourceCode":"\n    private IEnumerable<ChatRequestMessage> ProcessImageMessage(IAgent agent, ImageMessage message)\n    {\n        if (agent.Name == message.From)\n        {\n            // image message from assistant is not supported\n            throw new ArgumentException(\"ImageMessage is not supported when message.From is the same with agent\");\n        }\n\n        var imageContentItem = this.CreateChatMessageImageContentItemFromImageMessage(message);\n        return [new ChatRequestUserMessage([imageContentItem]) { Name = message.From }];\n    }\n\n    private IEnumerable<ChatRequestMessage> ProcessMultiModalMessage(IAgent agent, MultiModalMessage message)\n    {\n        if (agent.Name == message.From)\n        {\n            // image message from assistant is not supported\n            throw new ArgumentException(\"MultiModalMessage is not supported when message.From is the same with agent\");\n        }\n\n        IEnumerable<ChatMessageContentItem> items = message.Content.Select<IMessage, ChatMessageContentItem>(ci => ci switch\n        {\n            TextMessage text => new ChatMessageTextContentItem(text.Content),\n            ImageMessage image => this.CreateChatMessageImageContentItemFromImageMessage(image),\n            _ => throw new NotImplementedException(),\n        });\n\n        return [new ChatRequestUserMessage(items) { Name = message.From }];\n    }\n\n    private ChatMessageImageContentItem CreateChatMessageImageContentItemFromImageMessage(ImageMessage message)\n    {\n        return message.Data is null && message.Url is not null\n            ? new ChatMessageImageContentItem(new Uri(message.Url))\n            : new ChatMessageImageContentItem(message.Data, message.Data?.MediaType);\n    }","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.OpenAI.V1/Middleware/OpenAIChatRequestMessageConnector.cs#L291-L327","documentation":"ArgumentException thrown by ProcessMultiModalMessage when a MultiModalMessage's From equals the agent's name. Like single images, mixed text+image content is only representable as a ChatRequestUserMessage, so an assistant-authored multimodal message cannot be fed back to the same agent.","triggerScenarios":"A MultiModalMessage with From == agent.Name reaching this connector — e.g. a DALL-E/vision agent's multimodal reply looped back into its own context in a group chat.","commonSituations":"Group chat histories broadcast to all participants including the originator; multimodal agent output cached and re-sent on the next turn.","solutions":["Filter out the agent's own MultiModalMessage instances before sending history to that agent","Store assistant multimodal output as text-only messages in shared history","Send the multimodal content to a different consumer agent"],"exampleFix":"// before\nvar history = new List<IMessage> { multiModalReplyFromSelf };\nawait agent.SendAsync(history); // throws\n\n// after\nvar history = allMessages.Where(m => m.From != agent.Name || m is TextMessage);\nawait agent.SendAsync(history);","handlingStrategy":"validation","validationCode":"var safeHistory = messages.Where(m => m is not MultiModalMessage mm || mm.From != agent.Name);","typeGuard":"static bool IsReplayableToAgent(MultiModalMessage m, IAgent agent) => m.From != agent.Name;","tryCatchPattern":"catch (ArgumentException ex) when (ex.Message.Contains(\"MultiModalMessage is not supported\")) { /* drop self multimodal from history and resend */ }","preventionTips":["Exclude the originator's multimodal messages when replaying","Convert assistant multimodal output to text summaries in group chat memory"],"tags":["autogen","dotnet","azure-openai","multimodal","group-chat"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}