microsoft/semantic-kernel · error · ArgumentException

No arguments are provided for {fullyResolvedFunctionName}.

Error message

No arguments are provided for {fullyResolvedFunctionName}.

What it means

Thrown when a Handlebars helper invoking a kernel function finds that the function has required parameters but no arguments were provided in the template call. The helper refuses to invoke the function because required inputs are missing.

Source

Thrown at dotnet/src/Extensions/PromptTemplates.Handlebars/Helpers/KernelHelpers/KernelFunctionHelpers.cs:77

            handlebarsInstance,
            fullyResolvedFunctionName,
            (Context context, Arguments handlebarsArguments) =>
            {
                // Get the parameters from the template arguments
                if (handlebarsArguments.Length is not 0)
                {
                    if (handlebarsArguments[0].GetType() == typeof(HashParameterDictionary))
                    {
                        ProcessHashArguments(functionMetadata, executionContext, (IDictionary<string, object>)handlebarsArguments[0], nameDelimiter);
                    }
                    else
                    {
                        ProcessPositionalArguments(functionMetadata, executionContext, handlebarsArguments);
                    }
                }
                else if (functionMetadata.Parameters.Any(p => p.IsRequired))
                {
                    throw new ArgumentException($"No arguments are provided for {fullyResolvedFunctionName}.");
                }

                KernelFunction function = kernel.Plugins.GetFunction(functionMetadata.PluginName, functionMetadata.Name);

                // Invoke the function and write the result to the template
                var result = InvokeKernelFunction(kernel, function, executionContext, cancellationToken);

                if (!allowDangerouslySetContent && result is string resultAsString)
                {
                    result = HttpUtility.HtmlEncode(resultAsString);
                }

                return result;
            });
    }

    /// <summary>
    /// Checks if handlebars argument is a valid type for the function parameter.

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Update the Handlebars template to pass all required parameters (e.g., {{Plugin-Function param="value"}}).
  2. Verify the function's required parameters via its metadata and ensure each is supplied in the template.
  3. If a parameter is optional, mark it IsRequired=false in the function definition.

Example fix

// before
{{MyPlugin-DoWork}}
// after
{{MyPlugin-DoWork input="hello" count=3}}
Defensive patterns

Strategy: validation

Validate before calling

var requiredParams = functionMetadata.Parameters.Where(p => p.IsRequired).ToList();
if (requiredParams.Count > 0 && argumentsSupplied == 0)
    throw new InvalidOperationException($"Function {functionMetadata.Name} requires: {string.Join(", ", requiredParams.Select(p => p.Name))}.");

Type guard

public static bool HasAllRequiredArgs(KernelFunctionMetadata meta, IEnumerable<string> supplied) =>
    meta.Parameters.Where(p => p.IsRequired).All(p => supplied.Contains(p.Name));

Try / catch

try
{
    var result = await template.RenderAsync(kernel, arguments).ConfigureAwait(false);
}
catch (ArgumentException ex) when (ex.Message.Contains("No arguments are provided"))
{
    _logger.LogError(ex, "Template function call missing required arguments.");
    throw;
}

Prevention

When it happens

Trigger: In KernelFunctionHelpers, when a function metadata has parameters with IsRequired and the template neither supplied hash arguments nor positional arguments, the code throws before attempting invocation.

Common situations: Writing a Handlebars template that calls a function helper without passing the required arguments, or mismatching the function signature (renamed/removed parameters) so the template no longer supplies them.

Related errors


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