microsoft/semantic-kernel · error · KernelException

The query string parameter '{parameterStyle}' serialization

Error message

The query string parameter '{parameterStyle}' serialization style is not supported.

What it means

Thrown by RestApiOperation.BuildQueryString when a query parameter's effective style (parameter.Style ?? Form) is not in s_parameterSerializers. Supported styles are Simple, Form, SpaceDelimited, and PipeDelimited. Unsupported styles for query (Label, Matrix, DeepObject) are rejected when the request query string is built.

Source

Thrown at dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs:269

    {
        var segments = new List<string>();

        var parameters = this.Parameters.Where(p => p.Location == RestApiParameterLocation.Query);

        foreach (var parameter in parameters)
        {
            var argument = this.GetArgumentForParameter(arguments, parameter);
            if (argument == null)
            {
                // Skipping not required parameter if no argument provided for it.    
                continue;
            }

            var parameterStyle = parameter.Style ?? RestApiParameterStyle.Form;

            if (!s_parameterSerializers.TryGetValue(parameterStyle, out var serializer))
            {
                throw new KernelException($"The query string parameter '{parameterStyle}' serialization style is not supported.");
            }

            var node = OpenApiTypeConverter.Convert(parameter.Name, parameter.Type, argument, parameter.Schema);

            // Serializing the parameter and adding it to the query string if there's an argument for it.
            segments.Add(serializer.Invoke(parameter, node));
        }

        return string.Join("&", segments);
    }

    /// <summary>
    /// Makes the current instance unmodifiable.
    /// </summary>
    internal void Freeze()
    {
        this._freezable.Freeze();
        this.Payload?.Freeze();

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Change the query parameter style to 'form' (default) or 'spaceDelimited'/'pipeDelimited' if the array shape fits.
  2. For deepObject needs, flatten the nested fields into separate simple query parameters in the spec.
  3. If unsupported at the spec level, preprocess the document or use a ParameterFilter to drop/replace the parameter.

Example fix

// before - deepObject style is not serialized
{ "name": "filter", "in": "query", "style": "deepObject", "schema": { } }

// after - flatten to form-style parameters
{ "name": "filter[name]", "in": "query", "style": "form", "schema": { } }
Defensive patterns

Strategy: validation

Validate before calling

var supported = new[] { "form", "spaceDelimited", "pipeDelimited", "simple" };
// iterate query params and flag deepObject/label/matrix before importing

Type guard

static readonly HashSet<string> SupportedQueryStyles = new() { "form", "spaceDelimited", "pipeDelimited", "simple" };
static bool IsSupportedQueryStyle(string? style) => style is null || SupportedQueryStyles.Contains(style.ToLowerInvariant());

Try / catch

try { operation.BuildQueryString(arguments); }
catch (KernelException ex) when (ex.Message.Contains("query string parameter") && ex.Message.Contains("serialization style is not supported"))
{ logger.LogError(ex, "Unsupported query serialization style in spec."); throw; }

Prevention

When it happens

Trigger: An OpenAPI query parameter declared with style label, style matrix, or style deepObject. The default for query is Form, so an absent style is safe; only an explicit unsupported style triggers this.

Common situations: A spec using deepObject for nested query serialization (common in some API styles) which SK does not implement; matrix or label styles copied from another toolchain.

Related errors


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