microsoft/semantic-kernel · error · KernelException
Map operation is a process. Use {nameof(ProcessMapBuilder)}.
Error message
Map operation is a process. Use {nameof(ProcessMapBuilder)}.{nameof(WhereInputEventIs)} to resolve target. What it means
Thrown by ProcessMapBuilder.ResolveFunctionTarget when the MapOperation is a ProcessBuilder. When the map wraps a sub-process, function target resolution via the standard path is invalid — you must use WhereInputEventIs to resolve targets on a process-backed map. This guard prevents incorrect internal API usage.
Source
Thrown at dotnet/src/Experimental/Process.Core/ProcessMapBuilder.cs:70
/// The map operation that will be executed for each element in the input.
/// </summary>
internal ProcessStepBuilder MapOperation { get; }
/// <inheritdoc/>
/// <remarks>
/// Never called as the map is a proxy for the map operation and does not have a function target.
/// </remarks>
internal override Dictionary<string, KernelFunctionMetadata> GetFunctionMetadataMap()
{
throw new NotImplementedException($"{nameof(ProcessMapBuilder)}.{nameof(GetFunctionMetadataMap)} should never be invoked");
}
/// <inheritdoc/>
internal override KernelProcessFunctionTarget ResolveFunctionTarget(string? functionName, string? parameterName)
{
if (this.MapOperation is ProcessBuilder processOperation)
{
throw new KernelException($"Map operation is a process. Use {nameof(ProcessMapBuilder)}.{nameof(WhereInputEventIs)} to resolve target.");
}
return this.MapOperation.ResolveFunctionTarget(functionName, parameterName);
}
/// <inheritdoc/>
internal override KernelProcessStepInfo BuildStep(ProcessBuilder processBuilder, KernelProcessStepStateMetadata? stateMetadata = null)
{
KernelProcessMapStateMetadata? mapMetadata = stateMetadata as KernelProcessMapStateMetadata;
// Build the edges first
var builtEdges = this.Edges.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Select(e => e.Build()).ToList());
// Define the map state
KernelProcessMapState state = new(this.Name, this.Version, this.Id);
return new KernelProcessMap(state, this.MapOperation.BuildStep(processBuilder, mapMetadata?.OperationState), builtEdges);
}View on GitHub (pinned to c028a0c7dc)
Solutions
- Use ProcessMapBuilder.WhereInputEventIs(eventId) to resolve targets when the map operation is a process.
- Avoid passing the ProcessMapBuilder directly to SendEventTo; instead obtain the correct target via WhereInputEventIs.
- If the map wraps a single step (not a process), use ResolveFunctionTarget as normal.
Example fix
// before — resolving function target on a process-backed map
var map = process.AddMap(subProcess);
edge.SendEventTo(new ProcessFunctionTargetBuilder(map, functionName: "DoWork")); // triggers ResolveFunctionTarget -> throws
// after — use event-based targeting for process-backed maps
edge.SendEventTo(map.WhereInputEventIs("DoWork")); Defensive patterns
Strategy: type-guard
Validate before calling
if (map.MapOperation is ProcessBuilder)
{
// Use event-based targeting for process-backed maps
target = map.WhereInputEventIs(eventId);
}
else
{
target = new ProcessFunctionTargetBuilder(map, functionName: functionName);
} Type guard
bool IsMapProcess(ProcessMapBuilder map) => map.MapOperation is ProcessBuilder;
Prevention
- Check whether the map operation is a ProcessBuilder before attempting function-target resolution.
- Use WhereInputEventIs for process-backed maps and function-target for step-backed maps.
- Avoid passing ProcessMapBuilder directly to SendEventTo without resolving the correct target type.
When it happens
Trigger: Internally calling ResolveFunctionTarget on a ProcessMapBuilder whose MapOperation is a ProcessBuilder. This typically happens when framework code or user code attempts to resolve a function target on a map-of-process using the standard step-based resolution path instead of the event-based path.
Common situations: Using the map builder with a sub-process and then calling an API that internally resolves function targets (e.g. SendEventTo with a function target on the map step); incorrectly passing the map builder as a target step in edge definitions.
Related errors
- Failed to resolve function target for {step.GetType().Name},
- Map operation is not a process.
- The target step {this.Name} has no functions.
- The target step has more than one function, so a function na
- The function {functionName} does not exist on step {this.Nam
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/7a5fb8c67a654a14.
Report an issue: GitHub.