jdx/mise · error · eyre::Report

{} is not a tar archive

Error message

{} is not a tar archive

What it means

open_tar refuses the single-file compression formats (Gz, Xz, Bz2, Zst, Br, Lz4, Sz) because they are not tar streams - there are no tar entries to iterate. The message names the offending format explicitly. Raw is silently assumed to be tar.gz, which is worth knowing when diagnosing.

Source

Thrown at src/file.rs:2005

    let f = File::open(archive)?;
    Ok(match format {
        // 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(())
}

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Use extract_archive, which dispatches or rejects these formats before reaching open_tar
  2. Fix format detection to recognize double extensions (.tar.gz -> TarGz) and treat bare .gz/.xz as single-file assets
  3. If the payload really is a tarball inside gzip, pass ExtractionFormat::TarGz explicitly
Defensive patterns

Strategy: type-guard

Type guard

fn is_tar_stream(f: ExtractionFormat) -> bool {
    f.is_tar_archive() || f == ExtractionFormat::Raw
}

Prevention

When it happens

Trigger: Calling untar/open_tar with one of those formats: usually a direct untar call with a misdetected format, or extension detection that only looks at the last suffix so binary.gz (not package.tar.gz) maps into the tar path.

Common situations: A bare foo.gz binary asset is fed to the tar code path; hand-written format detection misses double extensions; a caller assumes Raw means anything other than gzip-tar.

Related errors


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