{"record":{"id":"389d9a6086d19d0c","repo":"microsoft/semantic-kernel","slug":"the-provided-quality-quality-is-not-supported","errorCode":null,"errorMessage":"The provided quality '{quality}' is not supported.","messagePattern":"The provided quality '(.+?)' is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.TextToImage.cs","lineNumber":128,"sourceCode":"        => size is null\n            ? null\n            : new GeneratedImageSize(size.Value.Width, size.Value.Height);\n\n    private static GeneratedImageQuality? GetGeneratedImageQuality(string? quality)\n    {\n        if (quality is null)\n        {\n            return null;\n        }\n\n        return quality.ToUpperInvariant() switch\n        {\n            \"STANDARD\" => GeneratedImageQuality.Standard,\n            \"HIGH\" or \"HD\" => GeneratedImageQuality.High,\n            \"MEDIUM\" => GeneratedImageQuality.MediumQuality,\n            \"LOW\" => GeneratedImageQuality.LowQuality,\n            \"AUTO\" => GeneratedImageQuality.Auto,\n            _ => throw new NotSupportedException($\"The provided quality '{quality}' is not supported.\")\n        };\n    }\n\n    private static GeneratedImageStyle? GetGeneratedImageStyle(string? style)\n    {\n        if (style is null)\n        {\n            return null;\n        }\n\n        return style.ToUpperInvariant() switch\n        {\n            \"VIVID\" => GeneratedImageStyle.Vivid,\n            \"NATURAL\" => GeneratedImageStyle.Natural,\n            _ => throw new NotSupportedException($\"The provided style '{style}' is not supported.\")\n        };\n    }\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.TextToImage.cs#L110-L146","documentation":"The image quality string is matched case-insensitively against STANDARD, HIGH, HD, MEDIUM, LOW, AUTO. Null is allowed (returns null, omitting the parameter). Any other value throws NotSupportedException before the request is sent.","triggerScenarios":"Passing an OpenAITextToImageExecutionSettings.Quality value not in the allowed set, e.g. 'ultra', 'best', or a numeric like '1'.","commonSituations":"Using a quality token from newer OpenAI API docs not yet mapped by the installed connector version. Passing a quality name that only applies to a different model (e.g. DALL-E 2 values used with DALL-E 3).","solutions":["Use one of: standard, high, hd, medium, low, auto (case-insensitive).","Leave Quality unset/null if you don't need to override the default.","Upgrade the connector package if a newer quality level is available upstream."],"exampleFix":"// before\nvar settings = new OpenAITextToImageExecutionSettings { Quality = \"ultra\" };\n\n// after\nvar settings = new OpenAITextToImageExecutionSettings { Quality = \"hd\" };","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> SupportedQualities = new(StringComparer.OrdinalIgnoreCase)\n{\n    \"standard\", \"high\", \"hd\", \"medium\", \"low\", \"auto\"\n};\n\nvoid ValidateQuality(string? quality)\n{\n    if (quality is not null && !SupportedQualities.Contains(quality.Trim()))\n        throw new ArgumentOutOfRangeException(nameof(quality),\n            $\"Quality must be one of: {string.Join(\", \", SupportedQualities)} (or null)\");\n}","typeGuard":null,"tryCatchPattern":"try { await imageService.GetTextToImageAsync(prompt, settings); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"quality\"))\n{\n    settings.Quality = null;\n    await imageService.GetTextToImageAsync(prompt, settings);\n}","preventionTips":["Leave Quality unset if the default is acceptable.","Check DALL-E model version — quality options differ between DALL-E 2 and 3."],"tags":["text-to-image","quality","validation","dalle"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}