{"record":{"id":"1f0d3739e0350a13","repo":"microsoft/autogen","slug":"the-method-or-operation-is-not-implemented-1f0d37","errorCode":null,"errorMessage":"The method or operation is not implemented.","messagePattern":"The method or operation is not implemented\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.OpenAI/Middleware/OpenAIChatRequestMessageConnector.cs","lineNumber":289,"sourceCode":"        }\n\n        var imageContentItem = this.CreateChatMessageImageContentItemFromImageMessage(message);\n        return [new UserChatMessage([imageContentItem]) { ParticipantName = message.From }];\n    }\n\n    private IEnumerable<ChatMessage> 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<ChatMessageContentPart> items = message.Content.Select<IMessage, ChatMessageContentPart>(ci => ci switch\n        {\n            TextMessage text => ChatMessageContentPart.CreateTextPart(text.Content),\n            ImageMessage image => this.CreateChatMessageImageContentItemFromImageMessage(image),\n            _ => throw new NotImplementedException(),\n        });\n\n        return [new UserChatMessage(items) { ParticipantName = message.From }];\n    }\n\n    private ChatMessageContentPart CreateChatMessageImageContentItemFromImageMessage(ImageMessage message)\n    {\n        return message.Data is null && message.Url is not null\n            ? ChatMessageContentPart.CreateImagePart(new Uri(message.Url))\n            : ChatMessageContentPart.CreateImagePart(message.Data, message.Data?.MediaType);\n    }\n\n    private IEnumerable<ChatMessage> ProcessToolCallMessage(IAgent agent, ToolCallMessage message)\n    {\n        if (message.From is not null && message.From != agent.Name)\n        {\n            throw new ArgumentException(\"ToolCallMessage is not supported when message.From is not the same with agent\");\n        }","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.OpenAI/Middleware/OpenAIChatRequestMessageConnector.cs#L271-L307","documentation":"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.","triggerScenarios":"Constructing MultiModalMessage with a content collection containing something other than TextMessage/ImageMessage, then sending it through the connector.","commonSituations":"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.","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."],"exampleFix":"// before\nvar items = new IMessage[] { new TextMessage(Role.User, \"describe\"), someToolCallMessage };\nvar mm = new MultiModalMessage(Role.User, items);\n\n// after\nvar items = new IMessage[] { new TextMessage(Role.User, \"describe\"), imageMessage };\nvar mm = new MultiModalMessage(Role.User, items);","handlingStrategy":"type-guard","validationCode":"// Validate multimodal content before constructing the message\nif (items.Any(i => i is not (TextMessage or ImageMessage)))\n    throw new ArgumentException(\"MultiModalMessage.Content supports only TextMessage and ImageMessage.\");","typeGuard":"static bool IsValidMultimodalContent(IEnumerable<IMessage> items) =>\n    items.All(i => i is TextMessage or ImageMessage);","tryCatchPattern":"catch (NotImplementedException) when (inMultimodalConversion)\n{\n    logger.LogError(\"Non text/image item in MultiModalMessage\");\n    throw;\n}","preventionTips":["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."],"tags":["openai","multimodal","message-connector","autogen","csharp"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}