{"record":{"id":"3aa1b8464df71b96","repo":"microsoft/semantic-kernel","slug":"the-edge-target-is-not-a-function-target-e-outpu","errorCode":null,"errorMessage":"The edge target is not a function target: {e.OutputTarget}","messagePattern":"The edge target is not a function target: (.+?)","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs","lineNumber":454,"sourceCode":"                    From = step.State.Id,\n                    Event = edge.Key,\n                    Condition = edge.Value.FirstOrDefault()?.Condition.DeclarativeDefinition\n                },\n                Then = [.. edge.Value.Select(e =>\n                {\n                    if (e.OutputTarget is KernelProcessFunctionTarget functionTarget)\n                    {\n                        return new ThenAction()\n                        {\n                            Node = functionTarget.StepId switch\n                            {\n                                ProcessConstants.EndStepName => \"End\",\n                                string s => s\n                            }\n                        };\n                    }\n\n                    throw new KernelException($\"The edge target is not a function target: {e.OutputTarget}\");\n                })]\n            };\n\n            orchestrationSteps.Add(orchestrationStep);\n        }\n\n        return node;\n    }\n\n    private static Node BuildAgentNode(KernelProcessAgentStep agentStep, List<OrchestrationStep> orchestrationSteps)\n    {\n        Verify.NotNull(agentStep);\n\n        if (agentStep.AgentDefinition is null || string.IsNullOrWhiteSpace(agentStep.State?.Id) || string.IsNullOrWhiteSpace(agentStep.AgentDefinition.Type))\n        {\n            throw new InvalidOperationException(\"Attempt to build a workflow node from step with no Id\");\n        }\n","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs#L436-L472","documentation":"Thrown by `BuildNode` while mapping a step's edges to `ThenAction`s: an edge's `OutputTarget` is not a `KernelProcessFunctionTarget`. The declarative workflow only supports edges that target a kernel function, so any other target type is rejected. It is a KernelException raised inside the edge-projection lambda.","triggerScenarios":"Construct a process edge whose `OutputTarget` is null or an unsupported subtype of the target base; programmatically build edges with a custom target type instead of `KernelProcessFunctionTarget`; deserialize a process whose edge targets lost their concrete type.","commonSituations":"Custom edge-target subclasses introduced without updating the builder; serialization polymorphism dropping the concrete function-target type; mixing runtimes that emit different target shapes.","solutions":["Ensure every edge is created with a `KernelProcessFunctionTarget` as its `OutputTarget` (use the standard `.SendEventTo(...)` / target-builder APIs).","If you have custom target types, convert them to `KernelProcessFunctionTarget` before calling `BuildWorkflow`.","Audit edge construction to confirm no null or non-function targets exist."],"exampleFix":"// before\nedge.OutputTarget = new MyCustomTarget();\n// after\nedge.OutputTarget = new KernelProcessFunctionTarget { StepId = \"NextStep\", FunctionName = \"Run\" };","handlingStrategy":"validation","validationCode":"foreach (var step in process.Steps)\n{\n    foreach (var edge in step.Edges.SelectMany(e => e.Value))\n    {\n        if (edge.OutputTarget is not KernelProcessFunctionTarget)\n            throw new InvalidOperationException($\"Edge on step '{step.State?.Id}' has a non-function output target ({edge.OutputTarget?.GetType().Name}).\");\n    }\n}","typeGuard":"bool HasFunctionTargets(KernelProcessStepInfo step) =>\n    step.Edges.SelectMany(e => e.Value).All(e => e.OutputTarget is KernelProcessFunctionTarget);","tryCatchPattern":"try { await WorkflowBuilder.BuildWorkflow(process); }\ncatch (KernelException ex) when (ex.Message.Contains(\"not a function target\"))\n{ _logger.LogError(ex, \"An edge target is not a KernelProcessFunctionTarget.\"); throw; }","preventionTips":["Build edges only through the official target-builder APIs so OutputTarget is always KernelProcessFunctionTarget.","Do not subclass the target type for custom routing without converting back before BuildWorkflow."],"tags":["workflow","process-framework","edges","serialization","validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}