{"record":{"id":"88ec1945f77e2d46","repo":"microsoft/autogen","slug":"the-method-or-operation-is-not-implemented","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.V1/Middleware/OpenAIChatRequestMessageConnector.cs","lineNumber":316,"sourceCode":"        }\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    }\n\n    private IEnumerable<ChatRequestMessage> 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":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.OpenAI.V1/Middleware/OpenAIChatRequestMessageConnector.cs#L298-L334","documentation":"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.","triggerScenarios":"Constructing new MultiModalMessage(Role.User, [textMessage, someOtherMessage]) where someOtherMessage is not TextMessage or ImageMessage, then sending it through the connector.","commonSituations":"Generic code that packages arbitrary message lists as multimodal content; future-proofing that assumed any IMessage could ride inside a multimodal message.","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"],"exampleFix":"// before\nvar mm = new MultiModalMessage(Role.User,\n    new IMessage[] { text, new ToolCallMessage(...) }); // throws on process\n\n// after\nvar mm = new MultiModalMessage(Role.User, new IMessage[] { text, image });\n// send the tool call separately","handlingStrategy":"validation","validationCode":"bool valid = multiModal.Content.All(ci => ci is TextMessage or ImageMessage);\nif (!valid) { /* strip unsupported items before sending */ }","typeGuard":"static bool ContainsOnlySupportedItems(MultiModalMessage m) => m.Content.All(ci => ci is TextMessage or ImageMessage);","tryCatchPattern":"catch (NotImplementedException) { /* split multimodal payload into supported messages and resend */ }","preventionTips":["Only package TextMessage/ImageMessage inside MultiModalMessage","Validate payloads in message-factory helpers"],"tags":["autogen","dotnet","azure-openai","multimodal","not-implemented"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}