jdx/mise · error
is not a tar archive
Error message
{} is not a tar archive What it means
open_tar rejects non-tar formats with "{} is not a tar archive". Single-file compressed formats (gz/xz/bz2/zst/br/lz4/sz), zip, 7z, and rar must never reach the tar reader; this guard fires when a non-tar format leaks into the tar open path.
Solutions
- Route compressed single files to decompress_file via the is_compressed_file() check
- Use extract_archive so zip/7z/rar are dispatched to the right handlers
- Verify the asset actually contains a tar stream (file tool / magic bytes) before tar extraction
- Fix the filename-to-format detection if the asset truly is a tarball but got misclassified
Example fix
// before
untar(&archive, &dest, fmt, &opts)?; // fmt == Gz
// after
if fmt.is_compressed_file() {
decompress_file(&archive, &dest.join("binary"), fmt)?;
} else {
untar(&archive, &dest, fmt, &opts)?;
} Defensive patterns
Strategy: validation
Validate before calling
if fmt.is_compressed_file() {
return Err(anyhow!("{fmt} is a single-file compression, use decompress_file"));
}
untar(&archive, &dest, fmt, &opts)?; Type guard
fn is_tar_or_raw(f: ExtractionFormat) -> bool {
f.is_tar_archive() || f == ExtractionFormat::Raw
} Try / catch
match untar(&archive, &dest, fmt, &opts) {
Err(e) if e.to_string().contains("is not a tar archive") => {
decompress_file(&archive, &dest.join("binary"), fmt)?;
}
other => other?,
} Prevention
- Check is_tar_archive() before any tar extraction
- Send compressed single files to decompress_file
- Inspect magic bytes (file/xxd) when asset naming is unreliable
- Route zip/7z/rar through extract_archive's dispatch table
When it happens
Trigger: Calling untar/open_tar with ExtractionFormat::Gz/Xz/Bz2/Zst/Br/Lz4/Sz (this arm) — e.g. a single compressed binary misrouted into the tar extraction path.
Common situations: Format detection returned a compression format because the asset is a lone compressed file, but the caller assumed an archive and called untar; dispatch logic bypassed extract_archive.
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
- content-level SLSA verification does not support…
- failed to archive remote source with
- untar only supports tar formats, got
- zip format not supported
- additional asset ' ' is not an archive
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/14b7707c34eab7c8.
Report an issue: GitHub.
Appendix: source
Thrown at src/file.rs:2196
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 533346cc37)