{"record":{"id":"14b7707c34eab7c8","repo":"jdx/mise","slug":"is-not-a-tar-archive","errorCode":null,"errorMessage":"{} is not a tar archive","messagePattern":"(.+?) is not a tar archive","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":2005,"sourceCode":"    let f = File::open(archive)?;\n    Ok(match format {\n        // TODO: we probably shouldn't assume raw is tar.gz, but this was to retain existing behavior\n        ExtractionFormat::TarGz | ExtractionFormat::Raw => Box::new(GzDecoder::new(f)),\n        ExtractionFormat::TarXz => Box::new(xz2::read::XzDecoder::new(f)),\n        ExtractionFormat::TarBz2 => Box::new(BzDecoder::new(f)),\n        ExtractionFormat::TarZst => Box::new(zstd::stream::read::Decoder::new(f)?),\n        ExtractionFormat::Tar => Box::new(f),\n        ExtractionFormat::TarBr | ExtractionFormat::TarLz4 | ExtractionFormat::TarSz => {\n            bail!(\"{format} format not supported\")\n        }\n        ExtractionFormat::Gz\n        | ExtractionFormat::Xz\n        | ExtractionFormat::Bz2\n        | ExtractionFormat::Zst\n        | ExtractionFormat::Br\n        | ExtractionFormat::Lz4\n        | ExtractionFormat::Sz => {\n            bail!(\"{} is not a tar archive\", format)\n        }\n        ExtractionFormat::Zip => bail!(\"zip format not supported\"),\n        ExtractionFormat::SevenZip => bail!(\"7z format not supported\"),\n        ExtractionFormat::Rar => bail!(\"rar format not supported\"),\n    })\n}\n\nfn reset_dir_mtime_to_now(dir: &Path) -> Result<()> {\n    let now = FileTime::now();\n    for entry in WalkDir::new(dir) {\n        let entry = entry?;\n        if entry.file_type().is_file() {\n            set_file_times(entry.path(), now, now)?;\n        }\n    }\n    Ok(())\n}\n","sourceCodeStart":1987,"sourceCodeEnd":2023,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/file.rs#L1987-L2023","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use extract_archive, which dispatches or rejects these formats before reaching open_tar","Fix format detection to recognize double extensions (.tar.gz -> TarGz) and treat bare .gz/.xz as single-file assets","If the payload really is a tarball inside gzip, pass ExtractionFormat::TarGz explicitly"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn is_tar_stream(f: ExtractionFormat) -> bool {\n    f.is_tar_archive() || f == ExtractionFormat::Raw\n}","tryCatchPattern":null,"preventionTips":["Route all extraction through extract_archive rather than open_tar/untar","Detect double extensions: binary.gz is a single file, package.tar.gz is a tar stream","Do not assume Raw is arbitrary content - open_tar decodes it as gzip tar"],"tags":["archive","extraction","tar","format-detection","rust","mise"],"backgroundTag":"unsupported-archive-format","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}