{"record":{"id":"6c40fea643b586ca","repo":"jdx/mise","slug":"unsupported-compressed-file-format","errorCode":null,"errorMessage":"unsupported compressed file format: {}","messagePattern":"unsupported compressed file format: (.+?)","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":1785,"sourceCode":"    }\n}\n\npub fn decompress_file(input: &Path, dest: &Path, format: ExtractionFormat) -> Result<()> {\n    if let Some(parent) = dest.parent()\n        && !parent.as_os_str().is_empty()\n    {\n        create_dir_all(parent)?;\n    }\n\n    run_blocking(|| match format {\n        ExtractionFormat::Gz => un_gz(input, dest),\n        ExtractionFormat::Xz => un_xz(input, dest),\n        ExtractionFormat::Zst => un_zst(input, dest),\n        ExtractionFormat::Bz2 => un_bz2(input, dest),\n        ExtractionFormat::Br | ExtractionFormat::Lz4 | ExtractionFormat::Sz => {\n            bail!(\"{format} format not supported\")\n        }\n        _ => bail!(\"unsupported compressed file format: {}\", format),\n    })\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, strum::EnumString, strum::Display)]\npub enum ExtractionFormat {\n    #[strum(to_string = \"tar.gz\", serialize = \"tgz\")]\n    TarGz,\n    #[strum(serialize = \"gz\")]\n    Gz,\n    #[strum(to_string = \"tar.xz\", serialize = \"txz\")]\n    TarXz,\n    #[strum(serialize = \"xz\")]\n    Xz,\n    #[strum(to_string = \"tar.bz2\", serialize = \"tbz2\", serialize = \"tbz\")]\n    TarBz2,\n    #[strum(serialize = \"bz2\")]\n    Bz2,\n    #[strum(to_string = \"tar.zst\", serialize = \"tzst\")]","sourceCodeStart":1767,"sourceCodeEnd":1803,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/file.rs#L1767-L1803","documentation":"Wildcard arm in `decompress_file` (src/file.rs:1785): the function is strictly for single compressed files, so container/archive formats — `tar.gz`, `tar.xz`, `tar.bz2`, `tar.zst`, `tar`, `zip`, raw — land here and bail. Writing a tarball through the single-file path would just copy compressed bytes to `dest`, so it is rejected.","triggerScenarios":"Code routing an archive asset to `decompress_file` instead of the untar/unzip path: a backend's extension-to-format detection maps `foo.tar.gz` to `Gz`, or a custom extraction spec names a container format where a bare compression is required.","commonSituations":"Regex-based extension checks matching `.gz` before `.tar.gz`; custom tool definitions specifying the tar variant for what is actually single-file extraction; new callers of decompress_file assuming it handles archives.","solutions":["Route containers to the archive path (untar/unzip); only bare `.gz/.xz/.zst/.bz2` belong in decompress_file","Fix the format detection that produced the container variant — match longer extensions (`.tar.gz`) before shorter ones (`.gz`)","For tool definitions, ensure the asset really is a single compressed file, or select the `tar.*`/zip handling instead"],"exampleFix":"// before — matches .tar.gz as Gz\nif name.ends_with(\".gz\") { decompress_file(&src, &dest, ExtractionFormat::Gz)? }\n\n// after — check the tar variant first\nif name.ends_with(\".tar.gz\") || name.ends_with(\".tgz\") { /* untar path */ }\nelse if name.ends_with(\".gz\") { decompress_file(&src, &dest, ExtractionFormat::Gz)? }","handlingStrategy":"validation","validationCode":"// route by format before extraction\nmatch format {\n    ExtractionFormat::Gz | ExtractionFormat::Xz | ExtractionFormat::Zst | ExtractionFormat::Bz2 => decompress_file(input, dest, format),\n    ExtractionFormat::TarGz | ExtractionFormat::TarXz | ExtractionFormat::TarBz2 | ExtractionFormat::TarZst | ExtractionFormat::Tar => untar(input, dest, format),\n    ExtractionFormat::Zip => unzip(input, dest),\n    _ => bail!(\"no handler for {format}\"),\n}","typeGuard":"fn is_container_format(name: &str) -> bool {\n    [\".tar.gz\", \".tgz\", \".tar.xz\", \".txz\", \".tar.bz2\", \".tbz2\", \".tar.zst\", \".tzst\", \".tar\", \".zip\"]\n        .iter().any(|e| name.ends_with(e))\n}","tryCatchPattern":"Catch `unsupported compressed file format` and re-dispatch: if the format is a tar variant or zip, call the archive path instead; otherwise surface the asset name so the user can pick a supported artifact.","preventionTips":["Order extension checks longest-first (`.tar.gz` before `.gz`) in any detection code","Never pass container formats to single-file decompression APIs","Add a unit test asserting each published asset extension maps to the correct extractor"],"tags":["mise","archive","compression","install","backend"],"backgroundTag":"unsupported-archive-format","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}