microsoft/semantic-kernel · error · KernelException
Parameter style of {parameter.Name} parameter of {operationI
Error message
Parameter style of {parameter.Name} parameter of {operationId} operation is undefined. What it means
Thrown by CreateRestApiOperationParameters when an OpenAPI parameter's 'style' field is null. Although 'style' has per-location defaults in the OpenAPI spec, this parser requires it to be explicitly set (non-null) so it can Enum.Parse it into a RestApiParameterStyle; an absent style is rejected rather than defaulted.
Source
Thrown at dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs:437
/// Creates REST API parameters.
/// </summary>
/// <param name="operationId">The operation id.</param>
/// <param name="parameters">The OpenAPI parameters.</param>
/// <returns>The parameters.</returns>
private static List<RestApiParameter> CreateRestApiOperationParameters(string operationId, IEnumerable<OpenApiParameter> parameters)
{
var result = new List<RestApiParameter>();
foreach (var parameter in parameters)
{
if (parameter.In is null)
{
throw new KernelException($"Parameter location of {parameter.Name} parameter of {operationId} operation is undefined.");
}
if (parameter.Style is null)
{
throw new KernelException($"Parameter style of {parameter.Name} parameter of {operationId} operation is undefined.");
}
var restParameter = new RestApiParameter(
parameter.Name,
parameter.Schema.Type,
parameter.Required,
parameter.Explode,
(RestApiParameterLocation)Enum.Parse(typeof(RestApiParameterLocation), parameter.In.ToString()!),
(RestApiParameterStyle)Enum.Parse(typeof(RestApiParameterStyle), parameter.Style.ToString()!),
parameter.Schema.Items?.Type,
GetParameterValue(parameter.Schema.Default, "parameter", parameter.Name),
parameter.Description,
parameter.Schema.Format,
parameter.Schema.ToJsonSchema()
);
result.Add(restParameter);
}View on GitHub (pinned to c028a0c7dc)
Solutions
- Add an explicit 'style' to each parameter matching its default per location: 'simple' for path/header, 'form' for query/cookie, or the intended array style.
- Post-process the spec to fill in defaults: path/header -> simple, query/cookie -> form.
- Regenerate the spec with a tool that always emits the 'style' field.
- Validate with a linter configured to flag missing style.
Example fix
// before - query parameter without style
{ "name": "tags", "in": "query", "schema": { "type": "array", "items": { "type": "string" } } }
// after - explicit form style
{ "name": "tags", "in": "query", "style": "form", "explode": true, "schema": { "type": "array", "items": { "type": "string" } } } Defensive patterns
Strategy: validation
Validate before calling
foreach (var (path, item) in doc.Paths)
foreach (var p in item.Operations.SelectMany(kv => kv.Value.Parameters))
if (p.Style is null)
throw new InvalidDataException($"Parameter '{p.Name}' on {path} is missing 'style'."); Type guard
static bool AllParametersHaveStyle(OpenApiDocument doc)
=> doc.Paths.SelectMany(p => p.Value.Operations.SelectMany(o => o.Value.Parameters)).All(p => p.Style is not null); Prevention
- Always set an explicit 'style' on every parameter.
- Defaults: simple for path/header, form for query/cookie.
- Post-process generated specs to fill in missing style values.
When it happens
Trigger: A parameter object in the spec that omits the 'style' property. The guard runs right after the 'in' check, so only parameters that already have a valid location reach this point. The subsequent Enum.Parse on parameter.Style would otherwise throw on null.
Common situations: A spec authored without explicit 'style' on its parameters (relying on OpenAPI defaults); a generated spec whose serializer omitted style when it matched the default; parameters imported from an older converter that did not emit style.
Related errors
- Parameter location of {parameter.Name} parameter of {operati
- Payload parameters cannot be retrieved from the '{operation.
- The headers parameter '{parameterStyle}' serialization style
- The query string parameter '{parameterStyle}' serialization
- The path parameter '{parameterStyle}' serialization style is
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/ccea23001488660d.
Report an issue: GitHub.