{"record":{"id":"499cf7078fa01e1a","repo":"microsoft/semantic-kernel","slug":"an-orchestration-is-referencing-a-node-with-id-a","errorCode":null,"errorMessage":"An orchestration is referencing a node with Id `{action.Node}` that does not exist.","messagePattern":"An orchestration is referencing a node with Id `(.+?)` that does not exist\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs","lineNumber":302,"sourceCode":"            }\n\n            // Now that we have a validated edge source, we can add the then actions\n            foreach (var action in thenActions)\n            {\n                if (action is null || string.IsNullOrWhiteSpace(action.Node))\n                {\n                    throw new ArgumentException(\"A complete then action is required for orchestration steps.\");\n                }\n\n                if (!this._stepBuilders.TryGetValue(action.Node, out ProcessStepBuilder? destinationStepBuilder))\n                {\n                    if (action.Node.Equals(\"End\", StringComparison.OrdinalIgnoreCase))\n                    {\n                        edgeBuilder.StopProcess();\n                        continue;\n                    }\n\n                    throw new ArgumentException($\"An orchestration is referencing a node with Id `{action.Node}` that does not exist.\");\n                }\n\n                // Add the edge to the node\n                edgeBuilder = edgeBuilder.SendEventTo(new ProcessFunctionTargetBuilder(destinationStepBuilder));\n            }\n        }\n\n        return Task.CompletedTask;\n    }\n\n    #endregion\n\n    #region FromProcess\n\n    /// <summary>\n    /// Builds a workflow from a kernel process.\n    /// </summary>\n    /// <param name=\"process\"></param>","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs#L284-L320","documentation":"Thrown by WorkflowBuilder when a `then` action's destination `Node` does not resolve to a registered step and is not the `\"End\"` terminal sentinel. The builder looks up the destination in `_stepBuilders`; an unresolved id means the orchestration points at a node that was never declared. It is an ArgumentException raised inside the `thenActions` loop in `AddOrchestrationStepAsync`.","triggerScenarios":"Reference a `then.node` value that is not in the `steps` collection and is not `\"End\"`; rename a destination step without updating incoming `then` references; use a node id with mismatched casing/whitespace.","commonSituations":"Refactoring a graph and deleting a step that other steps still route to; typos in hand-authored YAML; version upgrades that changed step id conventions.","solutions":["Verify every `then.node` value matches a declared step Id exactly, or is the literal `\"End\"`.","After deleting or renaming a step, grep the workflow for stale `then.node` references and update them.","Run a pre-build integrity check mapping all `then.node` values against the registered step set."],"exampleFix":"// before\nthen:\n  - node: OldStepName\n// after\nthen:\n  - node: RenamedStep","handlingStrategy":"validation","validationCode":"var stepIds = new HashSet<string>(workflow.Nodes.Select(n => n.Id), StringComparer.Ordinal);\nstepIds.Add(\"End\");\nforeach (var step in workflow.Orchestration)\n{\n    if (step.Then is null) continue;\n    foreach (var action in step.Then)\n    {\n        if (action is null) continue;\n        if (!stepIds.Contains(action.Node))\n            throw new InvalidOperationException($\"then.node '{action.Node}' is not a declared step and not 'End'.\");\n    }\n}","typeGuard":"bool IsValidThenNode(Workflow wf, string node) =>\n    node.Equals(\"End\", StringComparison.OrdinalIgnoreCase)\n    || wf.Nodes.Any(n => string.Equals(n.Id, node, StringComparison.Ordinal));","tryCatchPattern":"try { await builder.BuildAsync(); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"does not exist\"))\n{ _logger.LogError(ex, \"Then action references unknown node.\"); throw; }","preventionTips":["When deleting a step, scan all orchestration 'then' entries for references and remove/update them.","Treat step ids as immutable; rename via a single migration pass."],"tags":["workflow","process-framework","validation","orchestration","declarative"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}