jdx/mise · error

unsupported compressed file format

Error message

unsupported compressed file format: {}

What it means

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.

Solutions

  1. Route tar/zip/7z formats to extract_archive instead of decompress_file
  2. Check the format with is_compressed_file() before calling decompress_file
  3. Give the asset a recognized single-file compression extension (gz/xz/zst/bz2) so classification succeeds
  4. If the file truly is uncompressed, handle it with a plain file copy rather than the decompress path

Example fix

// before
decompress_file(&asset, &dest, fmt)?; // fmt == TarGz
// after
if fmt.is_tar_archive() || fmt == ExtractionFormat::Zip {
    extract_archive(&asset, &dest_dir, fmt, &opts)?;
} else {
    decompress_file(&asset, &dest, fmt)?;
}
Defensive patterns

Strategy: validation

Validate before calling

if fmt.is_compressed_file() {
    decompress_file(&input, &dest, fmt)?;
} else {
    extract_archive(&input, &dest_dir, fmt, &opts)?;
}

Type guard

fn is_single_file_compression(f: ExtractionFormat) -> bool {
    f.is_compressed_file()
}

Try / catch

match decompress_file(&input, &dest, fmt) {
    Err(e) if e.to_string().starts_with("unsupported compressed file format") => {
        extract_archive(&input, &dest_dir, fmt, &opts)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at src/file.rs:1976

    }
}

pub(crate) fn decompress_file(input: &Path, dest: &Path, format: ExtractionFormat) -> Result<()> {
    if let Some(parent) = dest.parent()
        && !parent.as_os_str().is_empty()
    {
        create_dir_all(parent)?;
    }

    run_blocking(|| match format {
        ExtractionFormat::Gz => un_gz(input, dest),
        ExtractionFormat::Xz => un_xz(input, dest),
        ExtractionFormat::Zst => un_zst(input, dest),
        ExtractionFormat::Bz2 => un_bz2(input, dest),
        ExtractionFormat::Br | ExtractionFormat::Lz4 | ExtractionFormat::Sz => {
            bail!("{format} format not supported")
        }
        _ => bail!("unsupported compressed file format: {}", format),
    })
}

#[derive(Debug, Clone, Copy, PartialEq, strum::EnumString, strum::Display)]
pub(crate) enum ExtractionFormat {
    #[strum(to_string = "tar.gz", serialize = "tgz")]
    TarGz,
    #[strum(serialize = "gz")]
    Gz,
    #[strum(to_string = "tar.xz", serialize = "txz")]
    TarXz,
    #[strum(serialize = "xz")]
    Xz,
    #[strum(to_string = "tar.bz2", serialize = "tbz2", serialize = "tbz")]
    TarBz2,
    #[strum(serialize = "bz2")]
    Bz2,
    #[strum(to_string = "tar.zst", serialize = "tzst")]

View on GitHub (pinned to 533346cc37)