jdx/mise · error

extract_archive does not support compressed single-file…

Error message

extract_archive does not support compressed single-file format: {format}

What it means

extract_archive handles archives (tar.*, zip, 7z) only. If given a compressed single-file format (Gz, Xz, Bz2, Zst, Br, Lz4, Sz), it bails with "extract_archive does not support compressed single-file format" because those payloads contain a single file, not a directory tree to extract.

Solutions

  1. Detect single-file compression first and call decompress_file (gz/xz/zst/bz2 only) instead
  2. Check fmt.is_compressed_file() and branch to the decompress + install-single-binary path
  3. Prefer assets published as tarballs or zips when configuring a tool backend
  4. For Br/Lz4/Sz, decompress externally — neither function supports them

Example fix

// before
extract_archive(&archive, &dest, fmt, &opts)?; // fmt == Gz
// after
if fmt.is_compressed_file() {
    decompress_file(&archive, &dest.join(binary_name), fmt)?;
} else {
    extract_archive(&archive, &dest, fmt, &opts)?;
}
Defensive patterns

Strategy: validation

Validate before calling

if fmt.is_compressed_file() {
    return Err(anyhow!("use decompress_file for {fmt}"));
}
extract_archive(&archive, &dest, fmt, &opts)?;

Type guard

fn is_archive_format(f: ExtractionFormat) -> bool { f.is_archive() }

Try / catch

match extract_archive(&archive, &dest, fmt, &opts) {
    Err(e) if e.to_string().contains("compressed single-file format") => {
        decompress_file(&archive, &dest.join("binary"), fmt)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling extract_archive with ExtractionFormat::from_file_name results like .gz/.xz/.bz2/.zst/.br/.lz4/.sz — e.g. a release asset is a single compressed binary, not a tarball.

Common situations: GitHub release assets that ship a lone gzipped binary (e.g. binary.gz); backend assumes every download is an archive and calls extract_archive unconditionally.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at src/file.rs:2126

        ExtractionFormat::TarGz
        | ExtractionFormat::TarXz
        | ExtractionFormat::TarBz2
        | ExtractionFormat::TarZst
        | ExtractionFormat::Tar
        | ExtractionFormat::TarBr
        | ExtractionFormat::TarLz4
        | ExtractionFormat::TarSz
        | ExtractionFormat::Raw => untar(archive, dest, format, opts),
        ExtractionFormat::Zip => unzip(archive, dest, opts),
        ExtractionFormat::SevenZip => un7z(archive, dest, opts),
        ExtractionFormat::Gz
        | ExtractionFormat::Xz
        | ExtractionFormat::Bz2
        | ExtractionFormat::Zst
        | ExtractionFormat::Br
        | ExtractionFormat::Lz4
        | ExtractionFormat::Sz => {
            bail!("extract_archive does not support compressed single-file format: {format}")
        }
        ExtractionFormat::Rar => bail!("rar format not supported"),
    }
}

pub(crate) fn untar(
    archive: &Path,
    dest: &Path,
    format: ExtractionFormat,
    opts: &ExtractOptions,
) -> Result<()> {
    if !format.is_tar_archive() && format != ExtractionFormat::Raw {
        bail!("untar only supports tar formats, got {}", format);
    }

    debug!("tar -xf {} -C {}", archive.display(), dest.display());
    if let Some(pr) = &opts.pr {
        pr.set_message(format!(

View on GitHub (pinned to 533346cc37)