{"record":{"id":"827278a5dd6f82cd","repo":"microsoft/semantic-kernel","slug":"unknown-image-detail-level-detaillevelstring","errorCode":null,"errorMessage":"Unknown image detail level '{detailLevelString}'. Supported values are 'Auto', 'Low' and 'High'.","messagePattern":"Unknown image detail level '(.+?)'\\. Supported values are 'Auto', 'Low' and 'High'\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs","lineNumber":955,"sourceCode":"        };\n    }\n\n    private static ChatImageDetailLevel? GetChatImageDetailLevel(ImageContent imageContent)\n    {\n        const string DetailLevelProperty = \"ChatImageDetailLevel\";\n\n        if (imageContent.Metadata is not null &&\n            imageContent.Metadata.TryGetValue(DetailLevelProperty, out object? detailLevel) &&\n            detailLevel is not null)\n        {\n            if (detailLevel is string detailLevelString && !string.IsNullOrWhiteSpace(detailLevelString))\n            {\n                return detailLevelString.ToUpperInvariant() switch\n                {\n                    \"AUTO\" => ChatImageDetailLevel.Auto,\n                    \"LOW\" => ChatImageDetailLevel.Low,\n                    \"HIGH\" => ChatImageDetailLevel.High,\n                    _ => throw new ArgumentException($\"Unknown image detail level '{detailLevelString}'. Supported values are 'Auto', 'Low' and 'High'.\")\n                };\n            }\n        }\n\n        return null;\n    }\n\n    private OpenAIChatMessageContent CreateChatMessageContent(OAIChat.ChatCompletion completion, string targetModel, bool retainArgumentTypes, OAIChat.ChatCompletionOptions options)\n    {\n        var message = new OpenAIChatMessageContent(completion, targetModel, this.GetChatCompletionMetadata(completion));\n\n        if (completion.OutputAudio is ChatOutputAudio outputAudio)\n        {\n            var audioContent = new AudioContent(outputAudio.AudioBytes, GetAudioOutputMimeType(options.AudioOptions))\n            {\n                Metadata = new Dictionary<string, object?>\n                {\n                    [nameof(outputAudio.Id)] = outputAudio.Id,","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs#L937-L973","documentation":"Thrown by GetChatImageDetailLevel when an image's metadata carries a 'ChatImageDetailLevel' string that is not Auto/Low/High (case-insensitive). The detail level controls OpenAI's vision processing budget; an unknown token cannot be sent, so an ArgumentException lists the valid values.","triggerScenarios":"Setting imageContent.Metadata[\"ChatImageDetailLevel\"] to a string like 'none', 'full', 'max', or a numeric value, then sending the image.","commonSituations":"Confusing this with the (separate) enum form; passing a value from another vision API; copy-pasting an unsupported token.","solutions":["Use only 'Auto', 'Low', or 'High' for the ChatImageDetailLevel metadata string.","Omit the metadata key entirely if you want the default (the method returns null and OpenAI picks a default).","If storing the enum, use the ChatImageDetailLevel enum instead of a free string."],"exampleFix":"// before\nimage.Metadata[\"ChatImageDetailLevel\"] = \"full\";\n// after\nimage.Metadata[\"ChatImageDetailLevel\"] = \"High\";","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> ValidDetail = new(StringComparer.OrdinalIgnoreCase) { \"auto\",\"low\",\"high\" };\nstatic void SetImageDetail(ImageContent img, string? d) { if (d is null) return; if (!ValidDetail.Contains(d)) throw new ArgumentException($\"Detail must be Auto/Low/High\"); img.Metadata[\"ChatImageDetailLevel\"] = d.ToLowerInvariant(); }","typeGuard":"static bool IsValidImageDetail(string? d) => d is null || ValidDetail.Contains(d);","tryCatchPattern":"try { await client.GetChatCompletionAsync(history); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"detail level\")) { /* remove metadata key and retry */ }","preventionTips":["Omit the key for default behavior.","Use only Auto/Low/High tokens."],"tags":["openai","vision","image-detail-level","metadata-validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}