microsoft/semantic-kernel · error · NotSupportedException
The provided style '{style}' is not supported.
Error message
The provided style '{style}' is not supported. What it means
The image style string is matched case-insensitively against only VIVID and NATURAL. Null is allowed (returns null). Any other value throws NotSupportedException before the request is sent. Style is a DALL-E 3-specific parameter.
Source
Thrown at dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.TextToImage.cs:143
"MEDIUM" => GeneratedImageQuality.MediumQuality,
"LOW" => GeneratedImageQuality.LowQuality,
"AUTO" => GeneratedImageQuality.Auto,
_ => throw new NotSupportedException($"The provided quality '{quality}' is not supported.")
};
}
private static GeneratedImageStyle? GetGeneratedImageStyle(string? style)
{
if (style is null)
{
return null;
}
return style.ToUpperInvariant() switch
{
"VIVID" => GeneratedImageStyle.Vivid,
"NATURAL" => GeneratedImageStyle.Natural,
_ => throw new NotSupportedException($"The provided style '{style}' is not supported.")
};
}
private static GeneratedImageFormat? GetResponseFormat(object? responseFormat)
{
if (responseFormat is null)
{
return null;
}
if (responseFormat is GeneratedImageFormat format)
{
return format;
}
if (responseFormat is string formatString)
{
return formatString.ToUpperInvariant() switchView on GitHub (pinned to c028a0c7dc)
Solutions
- Use 'vivid' or 'natural' (case-insensitive), or leave Style unset for the API default.
- If you need fine-grained stylistic control, express it in the text prompt instead of the style parameter.
Example fix
// before
var settings = new OpenAITextToImageExecutionSettings { Style = "cinematic" };
// after
var settings = new OpenAITextToImageExecutionSettings { Style = "vivid" }; Defensive patterns
Strategy: validation
Validate before calling
static readonly HashSet<string> SupportedStyles = new(StringComparer.OrdinalIgnoreCase)
{
"vivid", "natural"
};
void ValidateStyle(string? style)
{
if (style is not null && !SupportedStyles.Contains(style.Trim()))
throw new ArgumentOutOfRangeException(nameof(style),
"Style must be 'vivid' or 'natural' (or null for default)");
} Try / catch
try { await imageService.GetTextToImageAsync(prompt, settings); }
catch (NotSupportedException ex) when (ex.Message.Contains("style"))
{
settings.Style = null;
await imageService.GetTextToImageAsync(prompt, settings);
} Prevention
- Remember Style is DALL-E 3 only — don't set it for DALL-E 2.
- Use the text prompt for stylistic control beyond vivid/natural.
When it happens
Trigger: Passing an OpenAITextToImageExecutionSettings.Style value like 'artistic', 'photorealistic', or 'cinematic' that isn't in the two-value allow-list.
Common situations: Expecting a richer style taxonomy than the two DALL-E 3 options. Passing a style from a different image API (e.g. Stable Diffusion). Misspelling 'vivid' or 'natural'.
Related errors
- The provided quality '{quality}' is not supported.
- The provided response format '{formatString}' is not support
- The generated image has no valid content.
- Invalid image size: {size.width}x{size.height}.
- Prompt is required.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/76edc07cda152367.
Report an issue: GitHub.