microsoft/semantic-kernel · error · KernelException

The path parameter '{parameterStyle}' serialization style is

Error message

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

What it means

Thrown by RestApiOperation.BuildPath when a path parameter's effective style (parameter.Style ?? Simple) is not in s_parameterSerializers (Simple, Form, SpaceDelimited, PipeDelimited). Path parameters default to Simple, so a missing style is fine; an explicit unsupported style (Label, Matrix, DeepObject) is rejected when the URL path is built.

Source

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

    /// <returns>The path.</returns>
    private string BuildPath(string pathTemplate, IDictionary<string, object?> arguments)
    {
        var parameters = this.Parameters.Where(p => p.Location == RestApiParameterLocation.Path);

        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.Simple;

            if (!s_parameterSerializers.TryGetValue(parameterStyle, out var serializer))
            {
                throw new KernelException($"The path 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 path.
            pathTemplate = pathTemplate.Replace($"{{{parameter.Name}}}", HttpUtility.UrlEncode(serializer.Invoke(parameter, node)));
        }

        ValidatePathSegments(pathTemplate);

        return pathTemplate;
    }

    private object? GetArgumentForParameter(IDictionary<string, object?> arguments, RestApiParameter parameter)
    {
        // Try to get the parameter value by the argument name.
        if (!string.IsNullOrEmpty(parameter.ArgumentName) &&
            arguments.TryGetValue(parameter.ArgumentName!, out object? argument) &&

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Set the path parameter style to 'simple' (or remove it so Simple is assumed).
  2. If the server requires matrix/label encoding, pre-encode the value yourself and pass it as a simple parameter, or contribute a custom serializer.
  3. Re-author the path so the parameter is interpolated plainly as {param} with Simple serialization.

Example fix

// before - matrix path style unsupported
{ "name": "id", "in": "path", "style": "matrix", "schema": { "type": "string" } }

// after - simple path style (default)
{ "name": "id", "in": "path", "style": "simple", "schema": { "type": "string" } }
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: An OpenAPI path parameter declared with style label ('.value') or style matrix (';key=value'), or deepObject. These produce path encodings SK does not implement.

Common situations: A spec authored with label or matrix path styles (valid per OpenAPI but uncommon); a converted spec retaining exotic styles; a server API that actually expects matrix-style path segments.

Related errors


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