microsoft/semantic-kernel · error · InvalidOperationException
Multiple targets found for the specified function and parame
Error message
Multiple targets found for the specified function and parameter '{functionName}.{parameterName}'. What it means
Thrown by ProcessBuilder.ResolveFunctionTarget when more than one entry-point step resolves the same functionName.parameterName combination, creating an ambiguous target. The method collects all successful resolutions across entry steps; if more than one matches, it cannot determine which to use.
Source
Thrown at dotnet/src/Experimental/Process.Core/ProcessBuilder.cs:102
{
try
{
targets.Add(step.ResolveFunctionTarget(functionName, parameterName));
}
catch (KernelException)
{
// If the function is not found on the source step, then we can ignore it.
}
}
// If no targets were found or if multiple targets were found, throw an exception.
if (targets.Count == 0)
{
throw new InvalidOperationException($"No targets found for the specified function and parameter '{functionName}.{parameterName}'.");
}
else if (targets.Count > 1)
{
throw new InvalidOperationException($"Multiple targets found for the specified function and parameter '{functionName}.{parameterName}'.");
}
return targets[0];
}
/// <inheritdoc/>
internal override void LinkTo(string eventId, ProcessStepEdgeBuilder edgeBuilder)
{
Verify.NotNull(edgeBuilder?.Source, nameof(edgeBuilder.Source));
Verify.NotNull(edgeBuilder?.Target, nameof(edgeBuilder.Target));
// Keep track of the entry point steps
this._entrySteps.Add(edgeBuilder.Source);
this._externalEventTargetMap[eventId] = edgeBuilder.Target;
base.LinkTo(eventId, edgeBuilder);
}
/// <inheritdoc/>View on GitHub (pinned to c028a0c7dc)
Solutions
- Provide an explicit functionName (and parameterName) that is unique across all entry-point steps.
- Rename [KernelFunction] attributes on entry steps so each function name is unique within the process.
- Reduce to a single entry-point step that exposes the target function, or split the process so each entry point has distinct function names.
Example fix
// before — two entry steps both named 'Execute'
// stepA.Execute and stepB.Execute both exist → ambiguous
process.ResolveFunctionTarget("Execute", null); // throws
// after — rename one function
// stepA has [KernelFunction("ExecuteA")], stepB has [KernelFunction("ExecuteB")]
process.ResolveFunctionTarget("ExecuteA", null); Defensive patterns
Strategy: validation
Validate before calling
// Check for function name collisions across entry-point steps.
public List<string> FindFunctionCollisions(ProcessBuilder process)
{
var allFunctions = process.Steps
.SelectMany(s => s.GetFunctionMetadataMap().Keys)
.GroupBy(k => k)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToList();
return allFunctions;
} Prevention
- Give each [KernelFunction] on entry-point steps a unique name within the process.
- Provide explicit functionName when resolving targets instead of relying on auto-inference.
- Audit function names across entry steps during process construction.
When it happens
Trigger: Multiple entry-point steps in the process each expose a KernelFunction with the same name (and matching parameter), and ResolveFunctionTarget is called with that function/parameter pair. The process cannot disambiguate which entry step to route to.
Common situations: A sub-process with two or more entry steps that each define a KernelFunction named the same (e.g., multiple steps with 'Execute'). Using auto-inference (null functionName) when there are multiple entry steps each with a single function. Linking edges to a process that has identically-named functions across different steps.
Related errors
- No targets found for the specified function and parameter '{
- At least one action must be provided.
- All declarative agents must have an Id or a Name assigned.
- AgentDefinition Id must be set
- Expression must be a property access expression
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/cc39adb15a0d16ba.
Report an issue: GitHub.