{"record":{"id":"543f4dfe2869a511","repo":"jdx/mise","slug":"bootstrap-resource-depends-on-missing-resourc","errorCode":null,"errorMessage":"bootstrap resource '{}' depends on missing resource '{}'","messagePattern":"bootstrap resource '(.+?)' depends on missing resource '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/resources.rs","lineNumber":277,"sourceCode":"        Ok(())\n    }\n\n    fn ordered(&self) -> Result<Vec<&ResourcePlan>> {\n        let mut incoming = self\n            .resources\n            .keys()\n            .cloned()\n            .map(|id| (id, 0_usize))\n            .collect::<IndexMap<_, _>>();\n        let mut outgoing: HashMap<ResourceId, Vec<ResourceId>> = HashMap::new();\n\n        for resource in self.resources.values() {\n            for dependency in resource.depends_on.iter().chain(&resource.order_after) {\n                let Some(count) = incoming.get_mut(&resource.id) else {\n                    unreachable!(\"every resource was added to incoming\")\n                };\n                if !self.resources.contains_key(dependency) {\n                    bail!(\n                        \"bootstrap resource '{}' depends on missing resource '{}'\",\n                        resource.id,\n                        dependency\n                    );\n                }\n                *count += 1;\n                outgoing\n                    .entry(dependency.clone())\n                    .or_default()\n                    .push(resource.id.clone());\n            }\n        }\n\n        let mut ready = incoming\n            .iter()\n            .filter_map(|(id, count)| (*count == 0).then_some(id.clone()))\n            .collect::<VecDeque<_>>();\n        let mut ordered = Vec::with_capacity(self.resources.len());","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/resources.rs#L259-L295","documentation":"When BootstrapPlan::ordered topologically sorts resources for execution, it validates every dependency and ordering edge points at a declared resource. If a resource's depends_on or order_after names an id absent from the plan, planning fails with this error naming both the dependent and the missing resource. This is the final safety net before building the execution order.","triggerScenarios":"`mise bootstrap` plan output (ordered) where a declared resource references a missing id via depends_on or order_after and the earlier insert/add_dependency guards didn't catch it (edge discovered during graph construction).","commonSituations":"Config generated or templated with conditional resources where one branch was skipped but its dependents remained; cross-file references where the referenced resource's file wasn't included; stale ids after refactors.","solutions":["The message names both resources; open the bootstrap config and find the dependent's depends_on/order_after list.","Declare the missing resource, or remove/fix the reference to it.","If the resource is conditionally generated, ensure the condition also applies to the referencing resource.","Re-run the bootstrap plan; ordering should now resolve without bailing."],"exampleFix":"# before\n[[bootstrap.resources]]\nid = \"app\"\ndepends_on = [\"db\"]  # 'db' not declared\n# after\n[[bootstrap.resources]]\nid = \"db\"\n[[bootstrap.resources]]\nid = \"app\"\ndepends_on = [\"db\"]","handlingStrategy":"validation","validationCode":"# Check both depends_on and order_after reference declared ids\nfor dep in $(grep -oP '(?<=\\[\")[^\"]+(?=\"\\])' mise.toml | sort -u); do\n  grep -q \"id = \\\"$dep\\\"\" mise.toml || echo \"missing resource: $dep\"\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit the full graph (depends_on + order_after) after any config refactor.","Generate dependent resources together with the resources they reference so conditions stay in sync.","Include all config files that declare referenced resources.","Always run the plan/dry-run step before bootstrap apply."],"tags":["bootstrap","config","dependency-graph"],"backgroundTag":"missing-dependency","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}