{"record":{"id":"53edb69865385f74","repo":"microsoft/semantic-kernel","slug":"parameter-location-of-parameter-name-parameter-o","errorCode":null,"errorMessage":"Parameter location of {parameter.Name} parameter of {operationId} operation is undefined.","messagePattern":"Parameter location of (.+?) parameter of (.+?) operation is undefined\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs","lineNumber":432,"sourceCode":"\n        return result;\n    }\n\n    /// <summary>\n    /// Creates REST API parameters.\n    /// </summary>\n    /// <param name=\"operationId\">The operation id.</param>\n    /// <param name=\"parameters\">The OpenAPI parameters.</param>\n    /// <returns>The parameters.</returns>\n    private static List<RestApiParameter> CreateRestApiOperationParameters(string operationId, IEnumerable<OpenApiParameter> parameters)\n    {\n        var result = new List<RestApiParameter>();\n\n        foreach (var parameter in parameters)\n        {\n            if (parameter.In is null)\n            {\n                throw new KernelException($\"Parameter location of {parameter.Name} parameter of {operationId} operation is undefined.\");\n            }\n\n            if (parameter.Style is null)\n            {\n                throw new KernelException($\"Parameter style of {parameter.Name} parameter of {operationId} operation is undefined.\");\n            }\n\n            var restParameter = new RestApiParameter(\n                parameter.Name,\n                parameter.Schema.Type,\n                parameter.Required,\n                parameter.Explode,\n                (RestApiParameterLocation)Enum.Parse(typeof(RestApiParameterLocation), parameter.In.ToString()!),\n                (RestApiParameterStyle)Enum.Parse(typeof(RestApiParameterStyle), parameter.Style.ToString()!),\n                parameter.Schema.Items?.Type,\n                GetParameterValue(parameter.Schema.Default, \"parameter\", parameter.Name),\n                parameter.Description,\n                parameter.Schema.Format,","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs#L414-L450","documentation":"Thrown by CreateRestApiOperationParameters when an OpenAPI parameter's 'in' field (path/query/header/cookie) is null. The 'in' field is required by the OpenAPI spec for every parameter, so a null value means the document is non-compliant or was authored incorrectly; SK refuses to guess the location.","triggerScenarios":"A parameter object in the spec that omits the 'in' property entirely, or a malformed parameter where the reader left In as null. Because the code immediately casts parameter.In to a RestApiParameterLocation enum, a null would also risk a NullReferenceException, so this guard fails fast with a clear message instead.","commonSituations":"A hand-authored spec missing the 'in' field on a parameter; a converted/generated spec that dropped the location; a parameter defined at the wrong level (e.g. a request-body field mislabeled as a parameter).","solutions":["Open the spec and add the missing 'in' field to the named parameter (one of path, query, header, cookie).","Run the spec through Swagger Editor / spectral to surface parameters missing required fields.","Regenerate the spec from the source if it was produced by a converter that lost the 'in' value.","Remove the malformed parameter if it is not actually needed."],"exampleFix":"// before - parameter missing 'in'\n{ \"name\": \"userId\", \"required\": true, \"schema\": { \"type\": \"string\" } }\n\n// after - location specified\n{ \"name\": \"userId\", \"in\": \"path\", \"required\": true, \"schema\": { \"type\": \"string\" } }","handlingStrategy":"validation","validationCode":"foreach (var (path, item) in doc.Paths)\n    foreach (var p in item.Operations.SelectMany(kv => kv.Value.Parameters))\n        if (p.In is null)\n            throw new InvalidDataException($\"Parameter '{p.Name}' on {path} is missing 'in'.\");","typeGuard":"static bool AllParametersHaveLocation(OpenApiDocument doc)\n    => doc.Paths.SelectMany(p => p.Value.Operations.SelectMany(o => o.Value.Parameters)).All(p => p.In is not null);","tryCatchPattern":null,"preventionTips":["Run the spec through a linter to flag parameters missing 'in'.","Always set 'in' (path/query/header/cookie) on every parameter.","Remove malformed parameters that are not actually used."],"tags":["openapi","parsing","parameter","non-compliant-spec"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}