{"record":{"id":"1b5e96713c53a436","repo":"microsoft/aspire","slug":"step-step-name-is-required-by-unknown-step-requiredby","errorCode":null,"errorMessage":"Step '{step.Name}' is required by unknown step '{requiredBy}'","messagePattern":"Step '(.+?)' is required by unknown step '(.+?)'","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs","lineNumber":835,"sourceCode":"            }\n        }\n\n        foreach (var step in steps)\n        {\n            foreach (var dependency in step.DependsOnSteps)\n            {\n                if (!stepNames.Contains(dependency))\n                {\n                    throw new InvalidOperationException(\n                        $\"Step '{step.Name}' depends on unknown step '{dependency}'\");\n                }\n            }\n\n            foreach (var requiredBy in step.RequiredBySteps)\n            {\n                if (!stepNames.Contains(requiredBy))\n                {\n                    throw new InvalidOperationException(\n                        $\"Step '{step.Name}' is required by unknown step '{requiredBy}'\");\n                }\n            }\n        }\n    }\n\n    /// <summary>\n    /// Executes pipeline steps by building a Task DAG where each step waits on its dependencies.\n    /// Failed steps prevent dependent steps from executing, while independent steps continue running.\n    /// </summary>\n    private static async Task ExecuteStepsAsTaskDag(\n        List<PipelineStep> steps,\n        Dictionary<string, PipelineStep> stepsByName,\n        PipelineContext context)\n    {\n        // Validate no cycles exist in the dependency graph\n        ValidateDependencyGraph(steps, stepsByName);\n","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs#L817-L853","documentation":"This is the mirror of the unknown-dependency check: ValidateSteps also verifies each name in a step's RequiredBySteps collection refers to an existing registered step. RequiredBySteps expresses 'this step must run before the named step'; pointing it at a step that does not exist breaks the ordering graph, so an InvalidOperationException is thrown.","triggerScenarios":"A step populates RequiredBySteps (or a helper like IsRequiredBy) with a name matching no registered step — typo, renamed/removed step, or a conditionally-registered requirer that did not get added in the current execution context.","commonSituations":"Symmetric wiring done from only one side: step A declares RequiredBy(\"B\") but B's registration is behind a flag or feature check that is false; renaming step B without updating A; string-typed wiring across packages where one package changed its step names in a newer version.","solutions":["Correct the RequiredBySteps entry to the exact Name of the registered step (ordinal comparison)","Ensure the step that is supposed to require it is actually registered under the current execution context/pipeline","Or invert the relationship: declare it as DependsOn on the other step, where the name is verified to exist","Remove the stale RequiredBySteps entry if the ordering constraint no longer applies"],"exampleFix":"// before\nstep.RequiredBySteps.Add(\"publish-model\");\n// after (actual registered name)\nstep.RequiredBySteps.Add(\"publish\");","handlingStrategy":"validation","validationCode":"var registered = pipeline.Steps.Select(s => s.Name).ToHashSet(StringComparer.Ordinal);\nforeach (var step in pipeline.Steps)\n    foreach (var req in step.RequiredBySteps)\n        if (!registered.Contains(req))\n            throw new InvalidOperationException($\"Step '{step.Name}' lists unknown requirer '{req}'\");","typeGuard":null,"tryCatchPattern":"try { await pipeline.ExecuteAsync(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"required by unknown step\"))\n{\n    // ex.Message names the step and the unknown requirer; correct or remove the entry\n}","preventionTips":["Prefer declaring ordering from one direction only (DependsOn) to avoid half-wired reverse references","Use shared constants for step names referenced across packages","Verify both sides of a RequiredBy relationship are registered under the same conditions","Remove stale RequiredBySteps entries when refactoring step names"],"tags":["pipeline","dependency","validation","configuration"],"backgroundTag":"missing-dependency","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}