microsoft/semantic-kernel · error · KernelException
The target step has more than one function, so a function na
Error message
The target step has more than one function, so a function name must be provided.
What it means
Thrown by ProcessStepBuilder.ResolveFunctionTarget when functionName is null or whitespace, the step has more than one function, and no function name was supplied to disambiguate. This is the target-side counterpart of error 475, triggered during incoming edge target resolution.
Source
Thrown at dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs:183
/// <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}");
}
// 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)
{View on GitHub (pinned to c028a0c7dc)
Solutions
- Provide the functionName explicitly when creating the target for a multi-function step.
- Use step.OnFunction("FunctionName") to specify which function receives the event.
- If ambiguity is unintended, review whether the step truly needs multiple kernel functions.
Example fix
// before var target = new ProcessFunctionTargetBuilder(multiFunctionStep); // no functionName // throws if step has >1 function // after var target = new ProcessFunctionTargetBuilder(multiFunctionStep, functionName: "ProcessData");
Defensive patterns
Strategy: validation
Validate before calling
if (targetStep.FunctionsDict.Count > 1 && string.IsNullOrWhiteSpace(functionName))
throw new InvalidOperationException(
$"Target step '{targetStep.Name}' has multiple functions. Provide functionName.");
var target = new ProcessFunctionTargetBuilder(targetStep, functionName: functionName); Type guard
bool TargetNeedsExplicitFunctionName(ProcessStepBuilder step) => step.FunctionsDict.Count > 1;
Prevention
- Provide functionName explicitly when the target step has multiple kernel functions.
- Use OnFunction or the ProcessFunctionTargetBuilder constructor with a functionName argument.
- When adding a second function to a step, audit all incoming edge definitions for missing function names.
When it happens
Trigger: Creating a ProcessFunctionTargetBuilder for a step with multiple kernel functions without specifying functionName. E.g. edge.SendEventTo(step.AsFunctionTarget()) where step has several [KernelFunction] methods.
Common situations: Using shorthand targeting APIs that omit the function name on multi-function steps; adding a second function to a previously single-function step and not updating edge definitions; dynamic process construction that doesn't track function names.
Related errors
- The step {this.Name} has more than one function, so a functi
- The target step {this.Name} has no functions.
- The function {functionName} does not exist on step {this.Nam
- Failed to resolve function target for {step.GetType().Name},
- Map operation is a process. Use {nameof(ProcessMapBuilder)}.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/c797461e75382167.
Report an issue: GitHub.