jdx/mise · error · eyre::Report

unsupported compressed file format: {}

Error message

unsupported compressed file format: {}

What it means

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.

Source

Thrown at src/file.rs:1785

    }
}

pub 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 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 9dcfcaa0dc)

Solutions

  1. Route containers to the archive path (untar/unzip); only bare `.gz/.xz/.zst/.bz2` belong in decompress_file
  2. Fix the format detection that produced the container variant — match longer extensions (`.tar.gz`) before shorter ones (`.gz`)
  3. For tool definitions, ensure the asset really is a single compressed file, or select the `tar.*`/zip handling instead

Example fix

// before — matches .tar.gz as Gz
if name.ends_with(".gz") { decompress_file(&src, &dest, ExtractionFormat::Gz)? }

// after — check the tar variant first
if name.ends_with(".tar.gz") || name.ends_with(".tgz") { /* untar path */ }
else if name.ends_with(".gz") { decompress_file(&src, &dest, ExtractionFormat::Gz)? }
Defensive patterns

Strategy: validation

Validate before calling

// route by format before extraction
match format {
    ExtractionFormat::Gz | ExtractionFormat::Xz | ExtractionFormat::Zst | ExtractionFormat::Bz2 => decompress_file(input, dest, format),
    ExtractionFormat::TarGz | ExtractionFormat::TarXz | ExtractionFormat::TarBz2 | ExtractionFormat::TarZst | ExtractionFormat::Tar => untar(input, dest, format),
    ExtractionFormat::Zip => unzip(input, dest),
    _ => bail!("no handler for {format}"),
}

Type guard

fn is_container_format(name: &str) -> bool {
    [".tar.gz", ".tgz", ".tar.xz", ".txz", ".tar.bz2", ".tbz2", ".tar.zst", ".tzst", ".tar", ".zip"]
        .iter().any(|e| name.ends_with(e))
}

Try / catch

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.

Prevention

When it happens

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

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

Related errors


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