{"record":{"id":"cdf6152ad7a000c8","repo":"microsoft/semantic-kernel","slug":"invalid-message-content-only-text-image-url-and","errorCode":null,"errorMessage":"Invalid message content, only text, image url and document url are supported.","messagePattern":"Invalid message content, only text, image url and document url are supported\\.","errorType":"validation","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.MistralAI/Client/MistralClient.cs","lineNumber":811,"sourceCode":"                {\n                    content.Add(new ImageUrlChunk(imageContent.Uri.ToString()));\n                    continue;\n                }\n\n                if (imageContent.DataUri is not null)\n                {\n                    content.Add(new ImageUrlChunk(imageContent.DataUri));\n                    continue;\n                }\n            }\n\n            if (item is BinaryContent binaryContent && binaryContent.Uri is not null)\n            {\n                content.Add(new DocumentUrlChunk(binaryContent.Uri.ToString()));\n                continue;\n            }\n\n            throw new NotSupportedException(\"Invalid message content, only text, image url and document url are supported.\");\n        }\n\n        return [new MistralChatMessage(chatMessage.Role.ToString(), content)];\n    }\n\n    private HttpRequestMessage CreatePost(object requestData, Uri endpoint, string apiKey, bool stream)\n    {\n        var httpRequestMessage = HttpRequest.CreatePostRequest(endpoint, requestData);\n        this.SetRequestHeaders(httpRequestMessage, apiKey, stream);\n\n        return httpRequestMessage;\n    }\n\n    private void SetRequestHeaders(HttpRequestMessage request, string apiKey, bool stream)\n    {\n        request.Headers.Add(\"User-Agent\", HttpHeaderConstant.Values.UserAgent);\n        request.Headers.Add(HttpHeaderConstant.Names.SemanticKernelVersion, HttpHeaderConstant.Values.GetAssemblyVersion(this.GetType()));\n        request.Headers.Add(\"Accept\", stream ? \"text/event-stream\" : \"application/json\");","sourceCodeStart":793,"sourceCodeEnd":829,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.MistralAI/Client/MistralClient.cs#L793-L829","documentation":"Thrown as a NotSupportedException when a chat message item is not recognized as TextContent, ImageContent, or BinaryContent (document). The Mistral connector only supports text, image URLs, and document URLs in message content; any other content type triggers this error during request serialization.","triggerScenarios":"Adding an unsupported content type (e.g., AudioContent, VideoContent, or a custom Content subclass) to a ChatMessageContent.Items collection that gets sent to Mistral.","commonSituations":"Sharing content-building code across connectors where another connector supports richer content types; upgrading the Semantic Kernel version and new content types became available but Mistral does not support them yet.","solutions":["Filter or convert unsupported content types to text before sending to Mistral.","Check each item's type: only include TextContent, ImageContent (with DataUri), or BinaryContent (with a Uri).","If sending audio/video, transcribe or convert to text first, or use a connector that supports that modality."],"exampleFix":"// before\nvar msg = new ChatMessageContent(AuthorRole.User, contents: new List<KernelContent>\n{\n    new TextContent(\"describe this\"),\n    new AudioContent(audioBytes, mimeType: \"audio/wav\") // unsupported by Mistral\n});\n\n// after\nvar msg = new ChatMessageContent(AuthorRole.User, contents: new List<KernelContent>\n{\n    new TextContent(\"describe this\"),\n    new ImageContent(dataUri) // supported\n});","handlingStrategy":"validation","validationCode":"var supported = msg.Items.All(i =>\n    i is TextContent or ImageContent or BinaryContent);\nif (!supported)\n    throw new InvalidOperationException(\"Unsupported content type for Mistral.\");","typeGuard":"static bool HasOnlySupportedContent(IEnumerable<KernelContent> items) =>\n    items.All(i => i is TextContent or ImageContent or BinaryContent);","tryCatchPattern":null,"preventionTips":["Do not share content-building code across connectors with different capabilities.","Filter content collections to supported types before sending to Mistral.","Check the connector docs for supported content modalities."],"tags":["mistralai","content-type","multimodal","not-supported"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}