microsoft/semantic-kernel · error · KernelException
The step {this.Name} has more than one function, so a functi
Error message
The step {this.Name} has more than one function, so a function name must be provided. What it means
Thrown by ProcessStepBuilder.ResolveFunctionName when the step has more than one kernel function but no explicit function name was provided. Auto-resolution only works when there is exactly one function to choose from; with multiple functions, ambiguity must be resolved by the caller.
Source
Thrown at dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs:137
// Register the group by GroupId.
this.IncomingEdgeGroups[edgeGroup.GroupId] = edgeGroup;
}
/// <summary>
/// Resolves the function name for the step.
/// </summary>
/// <returns></returns>
/// <exception cref="KernelException"></exception>
private string ResolveFunctionName()
{
if (this.FunctionsDict.Count == 0)
{
throw new KernelException($"The step {this.Name} has no functions.");
}
else if (this.FunctionsDict.Count > 1)
{
throw new KernelException($"The step {this.Name} has more than one function, so a function name must be provided.");
}
return this.FunctionsDict.Keys.First();
}
/// <summary>
/// Links the output of the current step to the an input of another step via the specified event type.
/// </summary>
/// <param name="eventId">The Id of the event.</param>
/// <param name="edgeBuilder">The targeted function.</param>
internal virtual void LinkTo(string eventId, ProcessStepEdgeBuilder edgeBuilder)
{
if (!this.Edges.TryGetValue(eventId, out List<ProcessStepEdgeBuilder>? edges) || edges == null)
{
edges = [];
this.Edges[eventId] = edges;
}
View on GitHub (pinned to c028a0c7dc)
Solutions
- Specify the function name explicitly when creating the target: step.OnFunction("FunctionName").SendEventTo(target).
- Use WhereInputEventIs or OnFunction with the specific function name to disambiguate.
- If only one function should be the target, remove or rename the other [KernelFunction] methods on the step.
Example fix
// before — step has two functions, no name specified
process.OnInputEvent("Start")
.SendEventTo(myStep.AsFunctionTarget()); // throws — ambiguous
// after — specify the function name
process.OnInputEvent("Start")
.SendEventTo(myStep.OnFunction("ProcessData")); Defensive patterns
Strategy: validation
Validate before calling
if (step.FunctionsDict.Count > 1 && string.IsNullOrWhiteSpace(functionName))
throw new InvalidOperationException(
$"Step '{step.Name}' has {step.FunctionsDict.Count} functions. Specify a function name.");
// proceed with resolution Type guard
bool NeedsExplicitFunctionName(ProcessStepBuilder step) => step.FunctionsDict.Count > 1;
Prevention
- Always specify the function name when targeting a step with multiple kernel functions.
- Use step.OnFunction("name") to disambiguate.
- Track which steps have multiple functions during design to ensure all edges specify a function name.
When it happens
Trigger: Calling an API that resolves a function target on a step with multiple [KernelFunction] methods, without specifying which function to target. E.g. edge.SendEventTo(step.AsFunctionTarget()) where step has multiple functions.
Common situations: Adding a step with several kernel functions and then using a convenience method that auto-resolves the function; refactoring a single-function step to add a second function without updating edge definitions; using generic targeting APIs that assume single-function steps.
Related errors
- The step {this.Name} has no functions.
- The target step has more than one function, so a function na
- The target step {this.Name} has no functions.
- The function {functionName} does not exist on step {this.Nam
- Type '{stepType.FullName}' must be a subclass of KernelProce
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/b30ac812c3ce0528.
Report an issue: GitHub.