{"record":{"id":"7a5fb8c67a654a14","repo":"microsoft/semantic-kernel","slug":"map-operation-is-a-process-use-nameof-processmap","errorCode":null,"errorMessage":"Map operation is a process. Use {nameof(ProcessMapBuilder)}.{nameof(WhereInputEventIs)} to resolve target.","messagePattern":"Map operation is a process\\. Use (.+?)\\.(.+?) to resolve target\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessMapBuilder.cs","lineNumber":70,"sourceCode":"    /// The map operation that will be executed for each element in the input.\n    /// </summary>\n    internal ProcessStepBuilder MapOperation { get; }\n\n    /// <inheritdoc/>\n    /// <remarks>\n    /// Never called as the map is a proxy for the map operation and does not have a function target.\n    /// </remarks>\n    internal override Dictionary<string, KernelFunctionMetadata> GetFunctionMetadataMap()\n    {\n        throw new NotImplementedException($\"{nameof(ProcessMapBuilder)}.{nameof(GetFunctionMetadataMap)} should never be invoked\");\n    }\n\n    /// <inheritdoc/>\n    internal override KernelProcessFunctionTarget ResolveFunctionTarget(string? functionName, string? parameterName)\n    {\n        if (this.MapOperation is ProcessBuilder processOperation)\n        {\n            throw new KernelException($\"Map operation is a process.  Use {nameof(ProcessMapBuilder)}.{nameof(WhereInputEventIs)} to resolve target.\");\n        }\n\n        return this.MapOperation.ResolveFunctionTarget(functionName, parameterName);\n    }\n\n    /// <inheritdoc/>\n    internal override KernelProcessStepInfo BuildStep(ProcessBuilder processBuilder, KernelProcessStepStateMetadata? stateMetadata = null)\n    {\n        KernelProcessMapStateMetadata? mapMetadata = stateMetadata as KernelProcessMapStateMetadata;\n\n        // Build the edges first\n        var builtEdges = this.Edges.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Select(e => e.Build()).ToList());\n\n        // Define the map state\n        KernelProcessMapState state = new(this.Name, this.Version, this.Id);\n\n        return new KernelProcessMap(state, this.MapOperation.BuildStep(processBuilder, mapMetadata?.OperationState), builtEdges);\n    }","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessMapBuilder.cs#L52-L88","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before — resolving function target on a process-backed map\nvar map = process.AddMap(subProcess);\nedge.SendEventTo(new ProcessFunctionTargetBuilder(map, functionName: \"DoWork\")); // triggers ResolveFunctionTarget -> throws\n\n// after — use event-based targeting for process-backed maps\nedge.SendEventTo(map.WhereInputEventIs(\"DoWork\"));","handlingStrategy":"type-guard","validationCode":"if (map.MapOperation is ProcessBuilder)\n{\n    // Use event-based targeting for process-backed maps\n    target = map.WhereInputEventIs(eventId);\n}\nelse\n{\n    target = new ProcessFunctionTargetBuilder(map, functionName: functionName);\n}","typeGuard":"bool IsMapProcess(ProcessMapBuilder map) => map.MapOperation is ProcessBuilder;","tryCatchPattern":null,"preventionTips":["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."],"tags":["map-builder","function-target","process-resolution","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}