jdx/mise · error

zip format not supported

Error message

zip format not supported

What it means

open_tar rejects Zip archives with "zip format not supported" — the tar reader cannot handle zip containers. Zip must be routed through unzip(); reaching this bail means zip escaped the dispatch in extract_archive and landed in the tar path.

Solutions

  1. Call extract_archive, which dispatches Zip to unzip automatically
  2. Call unzip directly for known-zip archives
  3. Correct format detection so the archive is classified as Zip and dispatched appropriately
  4. For raw zip bytes, extract with the zip crate directly rather than the tar reader

Example fix

// before
untar(&archive, &dest, ExtractionFormat::Zip, &opts)?;
// after
unzip(&archive, &dest, &opts)?; // or extract_archive(...)
Defensive patterns

Strategy: validation

Validate before calling

if matches!(fmt, ExtractionFormat::Zip) {
    unzip(&archive, &dest, &opts)?;
} else {
    untar(&archive, &dest, fmt, &opts)?;
}

Type guard

fn is_zip(f: ExtractionFormat) -> bool {
    matches!(f, ExtractionFormat::Zip) // includes .vsix alias
}

Try / catch

match untar(&archive, &dest, fmt, &opts) {
    Err(e) if e.to_string().contains("zip format not supported") => {
        unzip(&archive, &dest, &opts)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling untar/open_tar directly with ExtractionFormat::Zip (or the alias Vsix), bypassing extract_archive's unzip dispatch.

Common situations: Custom install code assumes all archives are tarballs; a .vsix (zip) extension asset is passed to untar; refactored dispatch dropped the extract_archive layer.

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/1f516b6d4eced255. Report an issue: GitHub.

Appendix: source

Thrown at src/file.rs:2198

        // TODO: we probably shouldn't assume raw is tar.gz, but this was to retain existing behavior
        ExtractionFormat::TarGz | ExtractionFormat::Raw => Box::new(GzDecoder::new(f)),
        ExtractionFormat::TarXz => Box::new(xz2::read::XzDecoder::new(f)),
        ExtractionFormat::TarBz2 => Box::new(BzDecoder::new(f)),
        ExtractionFormat::TarZst => Box::new(zstd::stream::read::Decoder::new(f)?),
        ExtractionFormat::Tar => Box::new(f),
        ExtractionFormat::TarBr | ExtractionFormat::TarLz4 | ExtractionFormat::TarSz => {
            bail!("{format} format not supported")
        }
        ExtractionFormat::Gz
        | ExtractionFormat::Xz
        | ExtractionFormat::Bz2
        | ExtractionFormat::Zst
        | ExtractionFormat::Br
        | ExtractionFormat::Lz4
        | ExtractionFormat::Sz => {
            bail!("{} is not a tar archive", format)
        }
        ExtractionFormat::Zip => bail!("zip format not supported"),
        ExtractionFormat::SevenZip => bail!("7z format not supported"),
        ExtractionFormat::Rar => bail!("rar format not supported"),
    })
}

fn reset_dir_mtime_to_now(dir: &Path) -> Result<()> {
    let now = FileTime::now();
    for entry in WalkDir::new(dir) {
        let entry = entry?;
        if entry.file_type().is_file() {
            set_file_times(entry.path(), now, now)?;
        }
    }
    Ok(())
}

fn strip_archive_path_components(dir: &Path, strip_depth: usize) -> Result<()> {
    if strip_depth == 0 {

View on GitHub (pinned to 533346cc37)