{"record":{"id":"d3d0075efa2d41ac","repo":"microsoft/semantic-kernel","slug":"no-argument-parameter-argumentname-parameter","errorCode":null,"errorMessage":"No argument '{parameter.ArgumentName ?? parameter.Name}' is provided for the '{parameter.Name}' required parameter of the operation - '{this.Id}'.","messagePattern":"No argument '(.+?)' is provided for the '(.+?)' required parameter of the operation - '(.+?)'\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs","lineNumber":370,"sourceCode":"    {\n        // Try to get the parameter value by the argument name.\n        if (!string.IsNullOrEmpty(parameter.ArgumentName) &&\n            arguments.TryGetValue(parameter.ArgumentName!, out object? argument) &&\n            argument is not null)\n        {\n            return argument;\n        }\n\n        // Try to get the parameter value by the parameter name.\n        if (arguments.TryGetValue(parameter.Name, out argument) &&\n            argument is not null)\n        {\n            return argument;\n        }\n\n        if (parameter.IsRequired)\n        {\n            throw new KernelException($\"No argument '{parameter.ArgumentName ?? parameter.Name}' is provided for the '{parameter.Name}' required parameter of the operation - '{this.Id}'.\");\n        }\n\n        return null;\n    }\n\n    /// <summary>\n    /// Returns operation server Url.\n    /// </summary>\n    /// <param name=\"serverUrlOverride\">Override for REST API operation server url.</param>\n    /// <param name=\"apiHostUrl\">The URL of REST API host.</param>\n    /// <param name=\"arguments\">The operation arguments.</param>\n    /// <returns>The operation server url.</returns>\n    private Uri GetServerUrl(Uri? serverUrlOverride, Uri? apiHostUrl, IDictionary<string, object?> arguments)\n    {\n        string serverUrlString;\n\n        if (serverUrlOverride is not null)\n        {","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperation.cs#L352-L388","documentation":"Thrown by GetArgumentForParameter when invoking a REST operation: a parameter marked required has no non-null argument under either its ArgumentName or its Name in the supplied arguments dictionary. This fires during URL/header/query building, so the request never goes out.","triggerScenarios":"Calling the generated kernel function without supplying a required parameter (path, query, header, or required payload field). The argument lookup tries both the OpenAPI name and the SK-sanitized ArgumentName (dashes replaced with underscores), so both must be absent for this to throw.","commonSituations":"Forgetting to pass a required path/query argument in KernelArguments; passing the argument under a key that does not match either the raw OpenAPI name or the underscore-sanitized name; a typo in the argument key; the model/agent not emitting a required tool-call argument.","solutions":["Supply all required parameters; check operation.GetParameters().Where(p => p.IsRequired) to enumerate them and their expected keys.","Use the ArgumentName (sanitized name) as the argument key - for a parameter named 'user-id', pass arguments[\"user_id\"].","The required flag is not adjustable in stock SK, so ensure the caller (LLM or code) always provides the value; consider adding a system-prompt instruction to always include it.","Catch KernelException around the invocation to surface a clear retry prompt to the model."],"exampleFix":"// before - required 'user_id' argument missing\nvar result = await kernel.InvokeAsync(plugin[\"getUser\"], new KernelArguments());\n\n// after - supply the required argument by its (sanitized) name\nvar args = new KernelArguments { [\"user_id\"] = \"123\" };\nvar result = await kernel.InvokeAsync(plugin[\"getUser\"], args);","handlingStrategy":"validation","validationCode":"var required = operation.GetParameters(execParams?.EnableDynamicPayload ?? true, execParams?.EnablePayloadNamespacing ?? false)\n    .Where(p => p.IsRequired);\nforeach (var p in required)\n{\n    var key = p.ArgumentName ?? p.Name;\n    if (!arguments.ContainsKey(key) || arguments[key] is null)\n        throw new ArgumentException($\"Missing required argument '{key}' for operation '{operation.Id}'.\");\n}","typeGuard":"static bool HasAllRequiredArguments(RestApiOperation op, IDictionary<string,object?> args, bool dyn)\n    => op.GetParameters(dyn).Where(p => p.IsRequired)\n        .All(p => (p.ArgumentName != null && args.ContainsKey(p.ArgumentName) && args[p.ArgumentName] is not null)\n               || (args.ContainsKey(p.Name) && args[p.Name] is not null));","tryCatchPattern":"try { await kernel.InvokeAsync(plugin[opId], arguments); }\ncatch (KernelException ex) when (ex.Message.Contains(\"required parameter of the operation\"))\n{ logger.LogWarning(ex, \"A required argument was missing; ask the model to retry.\"); }","preventionTips":["Enumerate required parameters and supply all of them by ArgumentName.","For dash-named params, use the underscore-sanitized ArgumentName key.","Add prompt guidance so the model always emits required tool arguments."],"tags":["openapi","rest-operation","argument","required-parameter","invocation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}