{"record":{"id":"744afad27d53a8f5","repo":"microsoft/aspire","slug":"step-stepname-not-found-in-pipeline-available-steps-744afa","errorCode":null,"errorMessage":"Step '{stepName}' not found in pipeline. Available steps: {availableSteps}","messagePattern":"Step '(.+?)' not found in pipeline\\. Available steps: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs","lineNumber":50,"sourceCode":"    /// final actions are not invoked.\n    /// </remarks>\n    [AspireExportIgnore(Reason = \"Delegate callbacks are not ATS-compatible.\")]\n    public static IDistributedApplicationPipeline WithFinalAction(\n        this IDistributedApplicationPipeline pipeline,\n        string stepName,\n        Func<PipelineStepContext, Task> action)\n    {\n        ArgumentNullException.ThrowIfNull(pipeline);\n        ArgumentException.ThrowIfNullOrEmpty(stepName);\n        ArgumentNullException.ThrowIfNull(action);\n\n        pipeline.AddPipelineConfiguration(context =>\n        {\n            var step = context.Steps.FirstOrDefault(candidate => candidate.Name == stepName);\n            if (step is null)\n            {\n                var availableSteps = string.Join(\", \", context.Steps.Select(candidate => $\"'{candidate.Name}'\"));\n                throw new InvalidOperationException(\n                    $\"Step '{stepName}' not found in pipeline. Available steps: {availableSteps}\");\n            }\n\n            step.AddFinalAction(action);\n            return Task.CompletedTask;\n        });\n\n        return pipeline;\n    }\n\n    /// <summary>\n    /// Disables the publish and deploy validation that requires build-only containers to be consumed by another resource.\n    /// </summary>\n    /// <param name=\"pipeline\">The distributed application pipeline.</param>\n    /// <returns>The distributed application pipeline for chaining.</returns>\n    /// <remarks>\n    /// This is an application-wide escape hatch for scenarios where the build-only container validation is too restrictive\n    /// for a particular app. Prefer wiring build-only containers through <c>PublishWithContainerFiles</c> or","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Pipelines/DistributedApplicationPipelineExtensions.cs#L32-L68","documentation":"WithFinalAction looks up a pipeline step by name and throws InvalidOperationException when no step with that name exists, listing all available step names. It is an eager validation that the requested step is part of the pipeline's model at configuration time.","triggerScenarios":"Calling pipeline.WithFinalAction(\"StepName\", action) where StepName does not match any step in context.Steps — typically a typo or a step added later than the extension's configuration callback runs.","commonSituations":"Misspelled step name (case-sensitive comparison); attaching a final action to a step from a different pipeline version or feature-gated source; referencing an internal step name that was renamed in a newer Aspire version.","solutions":["Copy one of the step names exactly from the 'Available steps' list in the message (matching is case-sensitive).","Ensure WithFinalAction is applied after the target step has been added to the pipeline.","Check the Aspire version for renames of built-in step names."],"exampleFix":"// before\npipeline.WithFinalAction(\"Build-Container-Images\", action);\n// after: use an exact name from the available-steps list\npipeline.WithFinalAction(\"build-container-images\", action);","handlingStrategy":"validation","validationCode":"// Verify the step exists before attaching a final action\nvar stepNames = pipeline.Model.Steps.Select(s => s.Name).ToHashSet(StringComparer.Ordinal);\nif (!stepNames.Contains(stepName))\n{\n    throw new ArgumentException($\"Unknown step '{stepName}'. Available: {string.Join(\", \", stepNames)}\");\n}","typeGuard":null,"tryCatchPattern":"try { pipeline.WithFinalAction(stepName, action); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"not found in pipeline\"))\n{\n    logger.LogError(ex, \"Check step name against available steps\");\n}","preventionTips":["Reference step names via constants or the step-defining API instead of inline string literals.","Remember matching is case-sensitive and ordinal.","Apply WithFinalAction after all steps are added to the pipeline."],"tags":["pipeline","step-not-found","naming"],"backgroundTag":"record-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}