microsoft/semantic-kernel · error · KernelException

No argument '{parameter.ArgumentName ?? parameter.Name}' is

Error message

No argument '{parameter.ArgumentName ?? parameter.Name}' is provided for the '{parameter.Name}' required parameter of the operation - '{this.Id}'.

What it means

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.

Source

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

    {
        // Try to get the parameter value by the argument name.
        if (!string.IsNullOrEmpty(parameter.ArgumentName) &&
            arguments.TryGetValue(parameter.ArgumentName!, out object? argument) &&
            argument is not null)
        {
            return argument;
        }

        // Try to get the parameter value by the parameter name.
        if (arguments.TryGetValue(parameter.Name, out argument) &&
            argument is not null)
        {
            return argument;
        }

        if (parameter.IsRequired)
        {
            throw new KernelException($"No argument '{parameter.ArgumentName ?? parameter.Name}' is provided for the '{parameter.Name}' required parameter of the operation - '{this.Id}'.");
        }

        return null;
    }

    /// <summary>
    /// Returns operation server Url.
    /// </summary>
    /// <param name="serverUrlOverride">Override for REST API operation server url.</param>
    /// <param name="apiHostUrl">The URL of REST API host.</param>
    /// <param name="arguments">The operation arguments.</param>
    /// <returns>The operation server url.</returns>
    private Uri GetServerUrl(Uri? serverUrlOverride, Uri? apiHostUrl, IDictionary<string, object?> arguments)
    {
        string serverUrlString;

        if (serverUrlOverride is not null)
        {

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Supply all required parameters; check operation.GetParameters().Where(p => p.IsRequired) to enumerate them and their expected keys.
  2. Use the ArgumentName (sanitized name) as the argument key - for a parameter named 'user-id', pass arguments["user_id"].
  3. 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.
  4. Catch KernelException around the invocation to surface a clear retry prompt to the model.

Example fix

// before - required 'user_id' argument missing
var result = await kernel.InvokeAsync(plugin["getUser"], new KernelArguments());

// after - supply the required argument by its (sanitized) name
var args = new KernelArguments { ["user_id"] = "123" };
var result = await kernel.InvokeAsync(plugin["getUser"], args);
Defensive patterns

Strategy: validation

Validate before calling

var required = operation.GetParameters(execParams?.EnableDynamicPayload ?? true, execParams?.EnablePayloadNamespacing ?? false)
    .Where(p => p.IsRequired);
foreach (var p in required)
{
    var key = p.ArgumentName ?? p.Name;
    if (!arguments.ContainsKey(key) || arguments[key] is null)
        throw new ArgumentException($"Missing required argument '{key}' for operation '{operation.Id}'.");
}

Type guard

static bool HasAllRequiredArguments(RestApiOperation op, IDictionary<string,object?> args, bool dyn)
    => op.GetParameters(dyn).Where(p => p.IsRequired)
        .All(p => (p.ArgumentName != null && args.ContainsKey(p.ArgumentName) && args[p.ArgumentName] is not null)
               || (args.ContainsKey(p.Name) && args[p.Name] is not null));

Try / catch

try { await kernel.InvokeAsync(plugin[opId], arguments); }
catch (KernelException ex) when (ex.Message.Contains("required parameter of the operation"))
{ logger.LogWarning(ex, "A required argument was missing; ask the model to retry."); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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