microsoft/semantic-kernel · error · KernelException

The target step {this.Name} has no functions.

Error message

The target step {this.Name} has no functions.

What it means

Thrown by ProcessStepBuilder.ResolveFunctionTarget when FunctionsDict is empty — the target step has no kernel functions registered. This is the target-side equivalent of error 474, fired when resolving a function/parameter target for an edge destination.

Source

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

    }

    /// <summary>
    /// Used to resolve the target function and parameter for a given optional function name and parameter name.
    /// This is used to simplify the process of creating a <see cref="KernelProcessFunctionTarget"/> by making it possible
    /// to infer the function and/or parameter names from the function metadata if only one option exists.
    /// </summary>
    /// <param name="functionName">The name of the function. May be null if only one function exists on the step.</param>
    /// <param name="parameterName">The name of the parameter. May be null if only one parameter exists on the function.</param>
    /// <returns>A valid instance of <see cref="KernelProcessFunctionTarget"/> for this step.</returns>
    /// <exception cref="InvalidOperationException"></exception>
    internal virtual KernelProcessFunctionTarget ResolveFunctionTarget(string? functionName, string? parameterName)
    {
        string? verifiedFunctionName = functionName;
        string? verifiedParameterName = parameterName;

        if (this.FunctionsDict.Count == 0)
        {
            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}");
        }

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Ensure the target step class has at least one method decorated with [KernelFunction].
  2. Verify the correct step type is being used as the edge target.
  3. If the step is only a source, do not wire incoming edges to it — wire them to a step with an input function instead.

Example fix

// before
public class SinkStep : KernelProcessStep { } // no kernel functions
edge.SendEventTo(sinkStep.OnFunction("Receive")); // throws

// after
public class SinkStep : KernelProcessStep
{
    [KernelFunction]
    public void Receive(string input) { }
}
edge.SendEventTo(sinkStep.OnFunction("Receive"));
Defensive patterns

Strategy: validation

Validate before calling

if (targetStep.FunctionsDict.Count == 0)
    throw new InvalidOperationException(
        $"Target step '{targetStep.Name}' has no kernel functions. Cannot wire incoming edge.");

edge.SendEventTo(targetStep.OnFunction("Receive"));

Type guard

bool IsValidTargetStep(ProcessStepBuilder step) => step.FunctionsDict.Count > 0;

Prevention

When it happens

Trigger: Wiring an edge to a step that has zero [KernelFunction] methods via SendEventTo or ProcessFunctionTargetBuilder. The target step's metadata shows no functions to route to.

Common situations: Targeting a state-only or marker step that has no kernel functions; the step class was meant to be used as a source (emit-only) but was wired as a destination; a step type was loaded whose methods lack the [KernelFunction] attribute.

Related errors


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