jdx/mise · error · eyre::Report

[bootstrap.directories].

Error message

[bootstrap.directories]."{}": recursive is only valid with state = "absent"

What it means

ManagedDirectoryTomlConfig conversion validates that the `recursive` flag is only used with state = "absent": recursion controls recursive removal and is meaningless (and likely a mistake) for directory creation. from_toml bails when state is Present and recursive is true.

Solutions

  1. Remove `recursive = true` from the present-state directory entry.
  2. If recursive removal is intended, keep recursive and set state = "absent" instead.
  3. Create needed parent directories as their own present-state directory entries.

Example fix

# before
[bootstrap.directories]
"/var/lib/app" = { state = "present", recursive = true }

# after
[bootstrap.directories]
"/var/lib/app" = { state = "present" }
Defensive patterns

Strategy: validation

Validate before calling

// rust
fn validate_dir_entry(state: State, recursive: bool) -> Result<(), &'static str> {
    if state == State::Present && recursive {
        return Err("recursive is only valid with state = \"absent\"");
    }
    Ok(())
}

Prevention

When it happens

Trigger: Building a managed directory from TOML where the table sets both `state = "present"` and `recursive = true`.

Common situations: Copy-pasting an absent-directory entry and flipping state to present without dropping recursive; misunderstanding recursive as 'create parent directories too'.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/9db22ad810fc4432. Report an issue: GitHub.

Appendix: source

Thrown at src/system/managed_files.rs:706

        crate::file::replace_path(source)
    } else {
        PathBuf::from(source)
    };
    if source.is_absolute() {
        source
    } else {
        base.join(source)
    }
}

impl ManagedDirectoryRequest {
    fn from_toml(
        path: PathBuf,
        config: ManagedDirectoryTomlConfig,
        origin: ResourceOrigin,
    ) -> Result<Self> {
        if config.state == ManagedState::Present && config.recursive {
            bail!(
                "[bootstrap.directories].\"{}\": recursive is only valid with state = \"absent\"",
                path.display()
            );
        }
        Ok(Self {
            path,
            phase: config.phase,
            owner: nonempty("owner", config.owner)?,
            group: nonempty("group", config.group)?,
            mode: parse_mode(config.mode.as_deref(), 0o755)?,
            state: config.state,
            recursive: config.recursive,
            replace: config.replace,
            notify: config.notify,
            origin,
            inspection: None,
        })
    }

View on GitHub (pinned to 533346cc37)