{"record":{"id":"4a7adc6ee5d8041f","repo":"microsoft/semantic-kernel","slug":"workflow-nodes-are-not-specified","errorCode":null,"errorMessage":"Workflow nodes are not specified.","messagePattern":"Workflow nodes are not specified\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs","lineNumber":41,"sourceCode":"{\n    private readonly Dictionary<string, ProcessStepBuilder> _stepBuilders = [];\n    private readonly Dictionary<string, CloudEvent> _inputEvents = [];\n    private string? _yaml;\n\n    /// <summary>\n    /// Builds a process from a workflow definition.\n    /// </summary>\n    /// <param name=\"workflow\">An instance of <see cref=\"Workflow\"/>.</param>\n    /// <param name=\"yaml\">Workflow definition in YAML format.</param>\n    /// <param name=\"stepTypes\">Collection of preloaded step types.</param>\n    public async Task<KernelProcess?> BuildProcessAsync(Workflow workflow, string yaml, Dictionary<string, Type>? stepTypes = null)\n    {\n        this._yaml = yaml;\n        var stepBuilders = new Dictionary<string, ProcessStepBuilder>();\n\n        if (workflow.Nodes is null || workflow.Nodes.Count == 0)\n        {\n            throw new ArgumentException(\"Workflow nodes are not specified.\");\n        }\n\n        if (workflow.Inputs is null)\n        {\n            throw new ArgumentException(\"Workflow inputs are not specified.\");\n        }\n\n        // TODO: Process outputs\n        // TODO: Process variables\n\n        ProcessBuilder processBuilder = new(workflow.Id, description: workflow.Description, stateType: typeof(ProcessDefaultState));\n\n        if (workflow.Inputs.Events?.CloudEvents is not null)\n        {\n            foreach (CloudEvent inputEvent in workflow.Inputs.Events.CloudEvents)\n            {\n                await this.AddInputEventAsync(inputEvent, processBuilder).ConfigureAwait(false);\n            }","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs#L23-L59","documentation":"Thrown by WorkflowBuilder.BuildProcessAsync when the Workflow has a null or empty Nodes collection. A workflow must declare at least one node to produce a process, so the builder rejects nodeless definitions up front.","triggerScenarios":"Calling BuildProcessAsync with a deserialized Workflow whose Nodes list is null or contains zero entries; passing a freshly constructed empty Workflow; YAML that omits the nodes section.","commonSituations":"Malformed or partial workflow YAML missing the 'nodes' array; deserialization defaulting Nodes to null; testing with a skeleton Workflow object.","solutions":["Ensure the workflow YAML/JSON includes a non-empty 'nodes' array before calling BuildProcessAsync.","Validate workflow.Nodes != null && workflow.Nodes.Count > 0 before invoking the builder.","Confirm the deserializer is mapping the nodes field correctly (property name/casing)."],"exampleFix":"// before\nawait builder.BuildProcessAsync(new Workflow { Id = \"w1\" }, yaml);\n\n// after: populate nodes (or validate first)\nif (workflow.Nodes is null || workflow.Nodes.Count == 0) { /* report */ return; }\nawait builder.BuildProcessAsync(workflow, yaml);","handlingStrategy":"validation","validationCode":"if (workflow.Nodes is null || workflow.Nodes.Count == 0)\n    throw new ArgumentException(\"Workflow must contain at least one node.\");","typeGuard":"static bool HasNodes(Workflow w) => w.Nodes is { Count: > 0 };","tryCatchPattern":"try { await builder.BuildProcessAsync(workflow, yaml); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"nodes are not specified\"))\n{ /* prompt for a valid workflow with nodes */ }","preventionTips":["Validate the workflow object graph before invoking the builder.","Author workflow YAML from templates that include a nodes array.","Unit-test the YAML deserializer to ensure Nodes is populated."],"tags":["semantic-kernel","process","workflow","validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}