{"record":{"id":"9bc44050461e7e65","repo":"jdx/mise","slug":"strip-components-1-is-not-supported","errorCode":null,"errorMessage":"strip-components > 1 is not supported","messagePattern":"strip-components > 1 is not supported","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":2029,"sourceCode":"}\n\nfn reset_dir_mtime_to_now(dir: &Path) -> Result<()> {\n    let now = FileTime::now();\n    for entry in WalkDir::new(dir) {\n        let entry = entry?;\n        if entry.file_type().is_file() {\n            set_file_times(entry.path(), now, now)?;\n        }\n    }\n    Ok(())\n}\n\nfn strip_archive_path_components(dir: &Path, strip_depth: usize) -> Result<()> {\n    if strip_depth == 0 {\n        return Ok(());\n    }\n    if strip_depth > 1 {\n        bail!(\"strip-components > 1 is not supported\");\n    }\n\n    let top_level_paths = ls(dir)?;\n\n    for path in top_level_paths {\n        if !path.symlink_metadata()?.is_dir() {\n            continue;\n        }\n\n        // rename the directory to a temp name to avoid conflicts when moving files\n        let temp_path = path.with_file_name(format!(\n            \"{}_tmp_strip\",\n            path.file_name().unwrap().to_string_lossy()\n        ));\n        do_rename(&path, &temp_path)?;\n\n        for entry in ls(&temp_path)? {\n            if let Some(file_name) = entry.file_name() {","sourceCodeStart":2011,"sourceCodeEnd":2047,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/file.rs#L2011-L2047","documentation":"strip_archive_path_components implements strip-components post-extraction (for formats that cannot strip while unpacking), and its rename-and-move algorithm only handles removing exactly one leading directory. strip_components of 2 or more has no implementation, so it fails fast instead of producing a wrong layout.","triggerScenarios":"Extracting with ExtractOptions { strip_components: 2 (or more), .. } on a code path that calls strip_archive_path_components after extraction.","commonSituations":"Tool config (strip_components = 2 in mise.toml, or strip_components: 2 in an aqua-registry entry) written for a tarball nested two directories deep; config copied from another project whose archive layout differs.","solutions":["Set strip_components to 0 or 1","Choose or produce an archive with a single top-level directory so depth 1 is sufficient","If deeper stripping is genuinely required, extract manually with the tar CLI (tar -xf a.tar.gz --strip-components=N -C dest) in a custom task"],"exampleFix":"# before (mise.toml / aqua entry)\nstrip_components = 2\n\n# after\nstrip_components = 1","handlingStrategy":"validation","validationCode":"let opts = ExtractOptions { strip_components: opts.strip_components.min(1), ..opts };","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep strip_components at 0 or 1 in mise.toml / aqua entries","Prefer archives with a single top-level wrapper directory over deep nesting","When a layout genuinely needs deeper stripping, use tar --strip-components=N in a custom task"],"tags":["archive","extraction","strip-components","config","rust","mise"],"backgroundTag":"strip-components-limit","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}