jdx/mise · error

strip-components > 1 is not supported

Error message

strip-components > 1 is not supported

What it means

After extraction, mise can move the single top-level directory to strip one path component (like tar's --strip-components=1), but stripping more than one level is not implemented. strip_archive_path_components bails when strip_depth > 1. This mirrors the simplified stripping model: archives are expected to have exactly one nesting level to remove.

Solutions

  1. Set strip_components to 0 or 1 in the registry/backend config
  2. Repackage or choose an archive whose binaries are at most one directory deep
  3. Use an http backend with a flat archive or extract manually in a task

Example fix

// before
[assets]
strip_components = 2
// after
[assets]
strip_components = 1
Defensive patterns

Strategy: validation

Validate before calling

if (config.strip_components > 1) throw new Error("strip_components must be 0 or 1");

Type guard

function isValidStripDepth(n) { return Number.isInteger(n) && n >= 0 && n <= 1; }

Prevention

When it happens

Trigger: Requesting extraction with strip_components set to 2 or higher (e.g. aqua/registry `strip_components: 2`, or a backend config value).

Common situations: Registry entries modeled on assets whose binaries are nested two directories deep (e.g. `pkg/{version}/bin/tool`); copying a tar --strip-components=2 invocation into mise config.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at src/file.rs:2220

}

fn reset_dir_mtime_to_now(dir: &Path) -> Result<()> {
    let now = FileTime::now();
    for entry in WalkDir::new(dir) {
        let entry = entry?;
        if entry.file_type().is_file() {
            set_file_times(entry.path(), now, now)?;
        }
    }
    Ok(())
}

fn strip_archive_path_components(dir: &Path, strip_depth: usize) -> Result<()> {
    if strip_depth == 0 {
        return Ok(());
    }
    if strip_depth > 1 {
        bail!("strip-components > 1 is not supported");
    }

    let top_level_paths = ls(dir)?;

    for path in top_level_paths {
        if !path.symlink_metadata()?.is_dir() {
            continue;
        }

        // rename the directory to a temp name to avoid conflicts when moving files
        let temp_path = path.with_file_name(format!(
            "{}_tmp_strip",
            path.file_name().unwrap().to_string_lossy()
        ));
        do_rename(&path, &temp_path)?;

        for entry in ls(&temp_path)? {
            if let Some(file_name) = entry.file_name() {

View on GitHub (pinned to 533346cc37)