{"record":{"id":"016affd58bcff38e","repo":"jdx/mise","slug":"extract-archive-does-not-support-compressed-single","errorCode":null,"errorMessage":"extract_archive does not support compressed single-file format: {format}","messagePattern":"extract_archive does not support compressed single-file format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":2126,"sourceCode":"        ExtractionFormat::TarGz\n        | ExtractionFormat::TarXz\n        | ExtractionFormat::TarBz2\n        | ExtractionFormat::TarZst\n        | ExtractionFormat::Tar\n        | ExtractionFormat::TarBr\n        | ExtractionFormat::TarLz4\n        | ExtractionFormat::TarSz\n        | ExtractionFormat::Raw => untar(archive, dest, format, opts),\n        ExtractionFormat::Zip => unzip(archive, dest, opts),\n        ExtractionFormat::SevenZip => un7z(archive, dest, opts),\n        ExtractionFormat::Gz\n        | ExtractionFormat::Xz\n        | ExtractionFormat::Bz2\n        | ExtractionFormat::Zst\n        | ExtractionFormat::Br\n        | ExtractionFormat::Lz4\n        | ExtractionFormat::Sz => {\n            bail!(\"extract_archive does not support compressed single-file format: {format}\")\n        }\n        ExtractionFormat::Rar => bail!(\"rar format not supported\"),\n    }\n}\n\npub(crate) fn untar(\n    archive: &Path,\n    dest: &Path,\n    format: ExtractionFormat,\n    opts: &ExtractOptions,\n) -> Result<()> {\n    if !format.is_tar_archive() && format != ExtractionFormat::Raw {\n        bail!(\"untar only supports tar formats, got {}\", format);\n    }\n\n    debug!(\"tar -xf {} -C {}\", archive.display(), dest.display());\n    if let Some(pr) = &opts.pr {\n        pr.set_message(format!(","sourceCodeStart":2108,"sourceCodeEnd":2144,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/file.rs#L2108-L2144","documentation":"extract_archive handles archives (tar.*, zip, 7z) only. If given a compressed single-file format (Gz, Xz, Bz2, Zst, Br, Lz4, Sz), it bails with \"extract_archive does not support compressed single-file format\" because those payloads contain a single file, not a directory tree to extract.","triggerScenarios":"Calling extract_archive with ExtractionFormat::from_file_name results like .gz/.xz/.bz2/.zst/.br/.lz4/.sz — e.g. a release asset is a single compressed binary, not a tarball.","commonSituations":"GitHub release assets that ship a lone gzipped binary (e.g. binary.gz); backend assumes every download is an archive and calls extract_archive unconditionally.","solutions":["Detect single-file compression first and call decompress_file (gz/xz/zst/bz2 only) instead","Check fmt.is_compressed_file() and branch to the decompress + install-single-binary path","Prefer assets published as tarballs or zips when configuring a tool backend","For Br/Lz4/Sz, decompress externally — neither function supports them"],"exampleFix":"// before\nextract_archive(&archive, &dest, fmt, &opts)?; // fmt == Gz\n// after\nif fmt.is_compressed_file() {\n    decompress_file(&archive, &dest.join(binary_name), fmt)?;\n} else {\n    extract_archive(&archive, &dest, fmt, &opts)?;\n}","handlingStrategy":"validation","validationCode":"if fmt.is_compressed_file() {\n    return Err(anyhow!(\"use decompress_file for {fmt}\"));\n}\nextract_archive(&archive, &dest, fmt, &opts)?;","typeGuard":"fn is_archive_format(f: ExtractionFormat) -> bool { f.is_archive() }","tryCatchPattern":"match extract_archive(&archive, &dest, fmt, &opts) {\n    Err(e) if e.to_string().contains(\"compressed single-file format\") => {\n        decompress_file(&archive, &dest.join(\"binary\"), fmt)?;\n    }\n    other => other?,\n}","preventionTips":["Branch on is_compressed_file() before choosing extract vs decompress","Prefer tarball/zip assets for tools that also publish bare .gz binaries","Remember Br/Lz4/Sz single files are unsupported in both paths","Centralize dispatch in one helper instead of calling extract_archive directly"],"tags":["archive","extraction","unsupported-format","wrong-function"],"backgroundTag":"incompatible-source-type","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}