{"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":null,"httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":1976,"sourceCode":"    }\n}\n\npub(crate) 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(crate) 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":1958,"sourceCodeEnd":1994,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/file.rs#L1958-L1994","documentation":"The catch-all arm of decompress_file rejects any ExtractionFormat that is not a single-file compression format with \"unsupported compressed file format: {format}\". It fires when a tar archive, zip, 7z, rar, or raw format is passed to decompress_file, which only handles gz/xz/zst/bz2 single-file payloads.","triggerScenarios":"Calling decompress_file with ExtractionFormat::Tar, TarGz, Zip, SevenZip, Rar, TarBr, etc. — e.g. from_file_name guessed Raw (no known extension) or the caller mixed up decompress_file and extract_archive.","commonSituations":"Asset filename has no recognizable extension so it classifies as Raw and is routed to decompression; caller mistakenly calls decompress_file for what is actually a .tar.gz archive.","solutions":["Route tar/zip/7z formats to extract_archive instead of decompress_file","Check the format with is_compressed_file() before calling decompress_file","Give the asset a recognized single-file compression extension (gz/xz/zst/bz2) so classification succeeds","If the file truly is uncompressed, handle it with a plain file copy rather than the decompress path"],"exampleFix":"// before\ndecompress_file(&asset, &dest, fmt)?; // fmt == TarGz\n// after\nif fmt.is_tar_archive() || fmt == ExtractionFormat::Zip {\n    extract_archive(&asset, &dest_dir, fmt, &opts)?;\n} else {\n    decompress_file(&asset, &dest, fmt)?;\n}","handlingStrategy":"validation","validationCode":"if fmt.is_compressed_file() {\n    decompress_file(&input, &dest, fmt)?;\n} else {\n    extract_archive(&input, &dest_dir, fmt, &opts)?;\n}","typeGuard":"fn is_single_file_compression(f: ExtractionFormat) -> bool {\n    f.is_compressed_file()\n}","tryCatchPattern":"match decompress_file(&input, &dest, fmt) {\n    Err(e) if e.to_string().starts_with(\"unsupported compressed file format\") => {\n        extract_archive(&input, &dest_dir, fmt, &opts)?;\n    }\n    other => other?,\n}","preventionTips":["Dispatch via extract_archive unless you know the payload is a single compressed file","Check is_compressed_file() before decompress_file","Give assets recognized gz/xz/zst/bz2 extensions so classification works","Handle Raw classification (unknown extension) with a copy, not decompression"],"tags":["archive","decompression","wrong-function","unsupported-format"],"backgroundTag":"invalid-argument-value","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"}