{"record":{"id":"ab42728dbb4b34d8","repo":"microsoft/semantic-kernel","slug":"map-operation-is-not-a-process","errorCode":null,"errorMessage":"Map operation is not a process.","messagePattern":"Map operation is not a process\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessMapBuilder.cs","lineNumber":43,"sourceCode":"\n    /// <summary>\n    /// Version of the map-step, used when saving the state of the step.\n    /// </summary>\n    public string Version { get; init; } = \"v1\";\n\n    /// <summary>\n    /// Retrieves the target for a given external event. The step associated with the target is the process itself (this).\n    /// </summary>\n    /// <param name=\"eventId\">The Id of the event</param>\n    /// <returns>An instance of <see cref=\"ProcessFunctionTargetBuilder\"/></returns>\n    /// <exception cref=\"KernelException\"></exception>\n    public ProcessFunctionTargetBuilder WhereInputEventIs(string eventId)\n    {\n        Verify.NotNullOrWhiteSpace(eventId, nameof(eventId));\n\n        if (this.MapOperation is not ProcessBuilder process)\n        {\n            throw new KernelException(\"Map operation is not a process.\");\n        }\n\n        ProcessFunctionTargetBuilder operationTarget = process.WhereInputEventIs(eventId);\n\n        return operationTarget with { Step = this, TargetEventId = eventId };\n    }\n\n    /// <summary>\n    /// 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    {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessMapBuilder.cs#L25-L61","documentation":"Thrown by ProcessMapBuilder.WhereInputEventIs when the MapOperation is not a ProcessBuilder (i.e. the map operation is a plain step, not a sub-process). WhereInputEventIs on a map only makes sense when the map operation is a full process that exposes external input events; a single step has no external event surface.","triggerScenarios":"Calling mapBuilder.WhereInputEventIs(eventId) when the ProcessMapBuilder was created with a ProcessStepBuilder (a single step) rather than a ProcessBuilder (a sub-process) as its map operation.","commonSituations":"Creating a map with AddMap(myStep) where myStep is a single step, then trying to route external events into the map as if it were a sub-process; misunderstanding the difference between a map-of-step and a map-of-process.","solutions":["If the map operation is a single step, do not call WhereInputEventIs on the map — target the step's function directly.","If you need external event routing into the map, make the map operation a ProcessBuilder sub-process instead of a single step."],"exampleFix":"// before\nvar map = process.AddMap(mySingleStep); // map operation is a step\nmap.WhereInputEventIs(\"StartEvent\"); // throws\n\n// after — target the step's function directly, or use a sub-process\nvar subProcess = new ProcessBuilder(\"SubProcess\");\nsubProcess.AddStepFromType<MyStep>();\nvar map = process.AddMap(subProcess);\nmap.WhereInputEventIs(\"StartEvent\"); // OK — map operation is a process","handlingStrategy":"type-guard","validationCode":"if (map.MapOperation is not ProcessBuilder)\n    throw new InvalidOperationException(\n        \"WhereInputEventIs requires the map operation to be a ProcessBuilder. For a single-step map, target the step directly.\");\n\nmap.WhereInputEventIs(eventId);","typeGuard":"bool IsMapProcess(ProcessMapBuilder map) => map.MapOperation is ProcessBuilder;","tryCatchPattern":null,"preventionTips":["Understand whether your map wraps a step or a sub-process before calling WhereInputEventIs.","Only use WhereInputEventIs on maps backed by ProcessBuilder sub-processes.","For single-step maps, target the step's function directly."],"tags":["map-builder","external-event","process-vs-step","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}