jdx/mise · error

directory '{}' cannot be present while managed parent '{}' i

Error message

directory '{}' cannot be present while managed parent '{}' is absent

What it means

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.

Source

Thrown at src/system/resources.rs:463

        let parent_id = ResourceId::new("directory", parent.to_string_lossy());
        match (directory.state, parent_state) {
            (
                super::managed_files::ManagedState::Present,
                super::managed_files::ManagedState::Present,
            ) => {
                plan.add_dependency(&id, parent_id)?;
            }
            (
                super::managed_files::ManagedState::Absent,
                super::managed_files::ManagedState::Absent,
            ) => {
                plan.add_dependency(&parent_id, id)?;
            }
            (
                super::managed_files::ManagedState::Present,
                super::managed_files::ManagedState::Absent,
            ) => {
                bail!(
                    "directory '{}' cannot be present while managed parent '{}' is absent",
                    directory.path.display(),
                    parent.display()
                );
            }
            (
                super::managed_files::ManagedState::Absent,
                super::managed_files::ManagedState::Present,
            ) => {}
        }
    }
    for file in files {
        let resource = file.plan()?;
        let id = resource.id.clone();
        plan.insert(resource)?;
        add_account_dependencies(
            &mut plan,
            &id,

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the stale child directory resource or mark it absent too
  2. Change the parent's state to present/managed so the child can exist
  3. Delete the on-disk child directory and rerun so states are consistent

Example fix

// before
[[bootstrap.directory]] path = "parent", state = "absent"
[[bootstrap.directory]] path = "parent/child", state = "present"
// after: mark child absent too, or keep parent present
[[bootstrap.directory]] path = "parent/child", state = "absent"
Defensive patterns

Strategy: validation

Validate before calling

if child.state == Present && parent.state == Absent { return Err("child present but parent absent"); }

Prevention

When it happens

Trigger: `plan` encounters a directory resource with state Present but its parent directory's ManagedState is Absent.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/5e67135f42eb9eb4. Report an issue: GitHub.