microsoft/semantic-kernel · error · KernelException

The function {functionName} does not exist on step {this.Nam

Error message

The function {functionName} does not exist on step {this.Name}

What it means

Thrown by ProcessStepBuilder.ResolveFunctionTarget when the explicitly provided functionName (after whitespace resolution) is not found in the step's FunctionsDict. The named function does not exist as a [KernelFunction] on the target step.

Source

Thrown at dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs:192

        {
            throw new KernelException($"The target step {this.Name} has no functions.");
        }

        // If the function name is null or whitespace, then there can only one function on the step
        if (string.IsNullOrWhiteSpace(verifiedFunctionName))
        {
            if (this.FunctionsDict.Count > 1)
            {
                throw new KernelException("The target step has more than one function, so a function name must be provided.");
            }

            verifiedFunctionName = this.FunctionsDict.Keys.First();
        }

        // Verify that the target function exists
        if (!this.FunctionsDict.TryGetValue(verifiedFunctionName!, out var kernelFunctionMetadata) || kernelFunctionMetadata is null)
        {
            throw new KernelException($"The function {functionName} does not exist on step {this.Name}");
        }

        // If the parameter name is null or whitespace, then the function must have 0 or 1 parameters
        if (string.IsNullOrWhiteSpace(verifiedParameterName))
        {
            var undeterminedParameters = kernelFunctionMetadata.Parameters.Where(p => p.ParameterType != typeof(KernelProcessStepContext)).ToList();

            if (undeterminedParameters.Count > 1)
            {
                // TODO: Uncomment the following line if we want to enforce parameter specification.
                //throw new KernelException($"The function {functionName} on step {this.Name} has more than one parameter, so a parameter name must be provided.");
            }

            // We can infer the parameter name from the function metadata
            if (undeterminedParameters.Count == 1)
            {
                parameterName = undeterminedParameters[0].Name;
                verifiedParameterName = parameterName;

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Verify the functionName exactly matches a [KernelFunction] method name (or its explicit name parameter) on the step type.
  2. Check for typos and case sensitivity — function names are case-sensitive.
  3. Inspect the step's FunctionsDict keys (from GetFunctionMetadataMap) to list valid function names.

Example fix

// before — function name typo
var target = new ProcessFunctionTargetBuilder(myStep, functionName: "ProcesData");
// throws — actual function is "ProcessData"

// after
var target = new ProcessFunctionTargetBuilder(myStep, functionName: "ProcessData");
Defensive patterns

Strategy: validation

Validate before calling

if (!step.FunctionsDict.TryGetValue(functionName, out var metadata) || metadata is null)
    throw new InvalidOperationException(
        $"Function '{functionName}' not found on step '{step.Name}'. " +
        $"Available: {string.Join(", ", step.FunctionsDict.Keys)}");

var target = new ProcessFunctionTargetBuilder(step, functionName: functionName);

Type guard

bool FunctionExistsOnStep(ProcessStepBuilder step, string functionName)
    => step.FunctionsDict.ContainsKey(functionName);

Prevention

When it happens

Trigger: Specifying a functionName in an edge target that doesn't match any [KernelFunction] method name on the step. The verifiedFunctionName lookup in FunctionsDict fails.

Common situations: Typo in the function name string; renaming a kernel function method without updating all edge definitions; case mismatch in function names; referencing a function from a different step type; version mismatch where a function was removed.

Related errors


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