jdx/mise · error
untar only supports tar formats, got
Error message
untar only supports tar formats, got {} What it means
untar asserts upfront that the given ExtractionFormat is a tar archive (or Raw, for legacy behavior) with "untar only supports tar formats, got {format}". It is an internal precondition: callers must route non-tar formats to unzip/un7z/decompress_file instead.
Solutions
- Call extract_archive instead of untar so zip/7z/single-file formats dispatch correctly
- Guard the call with format.is_tar_archive() || format == Raw before invoking untar
- Fix format detection so zip archives are classified as Zip and routed to unzip
- For raw compressed files, use decompress_file rather than untar
Example fix
// before untar(&archive, &dest, ExtractionFormat::Zip, &opts)?; // after extract_archive(&archive, &dest, ExtractionFormat::Zip, &opts)?;
Defensive patterns
Strategy: validation
Validate before calling
if !(fmt.is_tar_archive() || fmt == ExtractionFormat::Raw) {
return Err(anyhow!("untar requires tar format, got {fmt}"));
}
untar(&archive, &dest, fmt, &opts)?; Type guard
fn is_untarable(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("untar only supports tar formats") => {
extract_archive(&archive, &dest, fmt, &opts)?; // correct dispatch
}
other => other?,
} Prevention
- Always dispatch archives through extract_archive, not untar directly
- Assert is_tar_archive() at call sites that need untar specifically
- Keep zip/7z/rar out of tar paths by testing format detection
- Remember Raw is allowed and treated as gzip-compressed tar (legacy behavior)
When it happens
Trigger: Calling untar directly (or via a code path that does) with Zip, SevenZip, Rar, Gz, Xz, Bz2, Zst, Br, Lz4, or Sz formats.
Common situations: Custom backend code dispatches every download to untar; format detection misclassifies a zip as extractable via tar; refactoring moved dispatch logic and dropped the extract_archive indirection.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- content-level SLSA verification does not support…
- failed to archive remote source with
- is not a tar archive
- additional asset ' ' is not an archive
- archive does not contain registry entries
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/d638d61b42a3d104.
Report an issue: GitHub.
Appendix: source
Thrown at src/file.rs:2139
| 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!(
"extract {}",
archive.file_name().unwrap().to_string_lossy()
));
}
let err = || {
let archive = display_path(archive);
let dest = display_path(dest);
format!("failed to extract tar: {archive} to {dest}")
};
run_blocking(|| {
let tar = open_tar(format, archive)?;View on GitHub (pinned to 533346cc37)