{"record":{"id":"5e67135f42eb9eb4","repo":"jdx/mise","slug":"directory-cannot-be-present-while-managed-par","errorCode":null,"errorMessage":"directory '{}' cannot be present while managed parent '{}' is absent","messagePattern":"directory '(.+?)' cannot be present while managed parent '(.+?)' is absent","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/resources.rs","lineNumber":463,"sourceCode":"        let parent_id = ResourceId::new(\"directory\", parent.to_string_lossy());\n        match (directory.state, parent_state) {\n            (\n                super::managed_files::ManagedState::Present,\n                super::managed_files::ManagedState::Present,\n            ) => {\n                plan.add_dependency(&id, parent_id)?;\n            }\n            (\n                super::managed_files::ManagedState::Absent,\n                super::managed_files::ManagedState::Absent,\n            ) => {\n                plan.add_dependency(&parent_id, id)?;\n            }\n            (\n                super::managed_files::ManagedState::Present,\n                super::managed_files::ManagedState::Absent,\n            ) => {\n                bail!(\n                    \"directory '{}' cannot be present while managed parent '{}' is absent\",\n                    directory.path.display(),\n                    parent.display()\n                );\n            }\n            (\n                super::managed_files::ManagedState::Absent,\n                super::managed_files::ManagedState::Present,\n            ) => {}\n        }\n    }\n    for file in files {\n        let resource = file.plan()?;\n        let id = resource.id.clone();\n        plan.insert(resource)?;\n        add_account_dependencies(\n            &mut plan,\n            &id,","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/resources.rs#L445-L481","documentation":"While planning directory resources, a directory marked Present whose managed parent directory is marked Absent is an inconsistent state — the child can't exist without the parent being created/managed. The planner rejects it rather than producing contradictory filesystem actions.","triggerScenarios":"`plan` encounters a directory resource with state Present but its parent directory's ManagedState is Absent.","commonSituations":"Config declares the parent directory as absent (to be removed) while child files/directories still exist on disk or are declared present; stale nested resources after config cleanup.","solutions":["Remove the stale child directory resource or mark it absent too","Change the parent's state to present/managed so the child can exist","Delete the on-disk child directory and rerun so states are consistent"],"exampleFix":"// before\n[[bootstrap.directory]] path = \"parent\", state = \"absent\"\n[[bootstrap.directory]] path = \"parent/child\", state = \"present\"\n// after: mark child absent too, or keep parent present\n[[bootstrap.directory]] path = \"parent/child\", state = \"absent\"","handlingStrategy":"validation","validationCode":"if child.state == Present && parent.state == Absent { return Err(\"child present but parent absent\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep parent/child state consistent in bootstrap config (absent parent implies absent children)","Clean up on-disk leftovers after removing a parent resource from config","Validate the resource tree before running the planner"],"tags":["bootstrap","filesystem","inconsistent-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}