{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":2220,"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":2202,"sourceCodeEnd":2238,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/file.rs#L2202-L2238","documentation":"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.","triggerScenarios":"Requesting extraction with strip_components set to 2 or higher (e.g. aqua/registry `strip_components: 2`, or a backend config value).","commonSituations":"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.","solutions":["Set strip_components to 0 or 1 in the registry/backend config","Repackage or choose an archive whose binaries are at most one directory deep","Use an http backend with a flat archive or extract manually in a task"],"exampleFix":"// before\n[assets]\nstrip_components = 2\n// after\n[assets]\nstrip_components = 1","handlingStrategy":"validation","validationCode":"if (config.strip_components > 1) throw new Error(\"strip_components must be 0 or 1\");","typeGuard":"function isValidStripDepth(n) { return Number.isInteger(n) && n >= 0 && n <= 1; }","tryCatchPattern":null,"preventionTips":["Keep strip_components at 0 or 1","Repackage archives to be one level deep","Review registry entries copied from tar CLI usage"],"tags":["archive","strip-components","config"],"backgroundTag":"value-out-of-range","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}