microsoft/semantic-kernel · error · NotSupportedException

The provided reasoning effort '{textEffortLevel}' is not sup

Error message

The provided reasoning effort '{textEffortLevel}' is not supported.

What it means

Thrown while converting the ReasoningEffort execution-settings value into a ChatReasoningEffortLevel. When the value is a string it is upper-cased and matched against LOW, MEDIUM, HIGH, and MINIMAL (the reasoning_effort values accepted by OpenAI o-series models). An unrecognized token means the caller asked for a reasoning budget the model or connector does not expose.

Source

Thrown at dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs:577

        if (effortLevelObject is null)
        {
            return null;
        }

        if (effortLevelObject is ChatReasoningEffortLevel effort)
        {
            return effort;
        }

        if (effortLevelObject is string textEffortLevel)
        {
            return textEffortLevel.ToUpperInvariant() switch
            {
                "LOW" => ChatReasoningEffortLevel.Low,
                "MEDIUM" => ChatReasoningEffortLevel.Medium,
                "HIGH" => ChatReasoningEffortLevel.High,
                "MINIMAL" => new("minimal"),
                _ => throw new NotSupportedException($"The provided reasoning effort '{textEffortLevel}' is not supported.")
            };
        }

        throw new NotSupportedException($"The provided reasoning effort '{effortLevelObject.GetType()}' is not supported.");
    }

    protected static ChatWebSearchOptions? GetWebSearchOptions(OpenAIPromptExecutionSettings executionSettings)
    {
        if (executionSettings.WebSearchOptions is null)
        {
            return null;
        }

        if (executionSettings.WebSearchOptions is ChatWebSearchOptions webSearchOptions)
        {
            return webSearchOptions;
        }

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Set ReasoningEffort to one of 'low', 'medium', 'high', or 'minimal' (any case).
  2. If you need a budget expressed as a number, remove ReasoningEffort and use a model/settings field that accepts numeric token budgets instead.
  3. Upgrade Connectors.OpenAI if the model genuinely supports a new effort level.
  4. Validate the config-sourced string against the allowed set before assigning it.

Example fix

// before
settings.ReasoningEffort = "ultra";
// after
settings.ReasoningEffort = "high";
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<string> ValidEfforts = new(StringComparer.OrdinalIgnoreCase) { "low","medium","high","minimal" };
static string NormalizeEffort(string? e) => (e is not null && ValidEfforts.Contains(e)) ? e!.ToLowerInvariant() : throw new ArgumentException($"ReasoningEffort must be one of: {string.Join(", ", ValidEfforts)}");

Type guard

static bool IsValidReasoningEffort(string? e) => e is not null && ValidEfforts.Contains(e);

Try / catch

try { await client.GetChatCompletionAsync(...); }
catch (NotSupportedException ex) when (ex.Message.Contains("reasoning effort")) { settings.ReasoningEffort = "medium"; /* retry */ }

Prevention

When it happens

Trigger: OpenAIPromptExecutionSettings.ReasoningEffort is set to a string that is not low/medium/high/minimal (case-insensitive), e.g. 'ultra', 'max', '0.5', or a typo like 'hihg'. The connector then cannot build the request payload for the model.

Common situations: Mixing vocabulary from a different vendor (e.g. Anthropic 'thinking budget' tokens), reading the value from config with a stray value, or using a value added in a newer OpenAI API than the connector supports.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/2eab63044a59bb1e. Report an issue: GitHub.