{"record":{"id":"1675ba0adbaa9a11","repo":"rust-lang/rust","slug":"tarball-extension-not-recognized","errorCode":null,"errorMessage":"tarball extension not recognized: {}","messagePattern":"tarball extension not recognized: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/tools/build-manifest/src/versions.rs","lineNumber":255,"sourceCode":"    }\n\n    fn load_version_from_tarball_inner(&mut self, tarball: &Path) -> Result<VersionInfo, Error> {\n        let file = match File::open(&tarball) {\n            Ok(file) => file,\n            Err(err) if err.kind() == std::io::ErrorKind::NotFound => {\n                // Missing tarballs do not return an error, but return empty data.\n                println!(\"warning: missing tarball {}\", tarball.display());\n                return Ok(VersionInfo::default());\n            }\n            Err(err) => return Err(err.into()),\n        };\n        let mut tar: Archive<Box<dyn std::io::Read>> =\n            Archive::new(if tarball.extension().map_or(false, |e| e == \"gz\") {\n                Box::new(GzDecoder::new(file))\n            } else if tarball.extension().map_or(false, |e| e == \"xz\") {\n                Box::new(XzDecoder::new(file))\n            } else {\n                unimplemented!(\"tarball extension not recognized: {}\", tarball.display())\n            });\n\n        let mut version = None;\n        let mut git_commit = None;\n        for entry in tar.entries()? {\n            let mut entry = entry?;\n\n            let dest;\n            match entry.path()?.components().nth(1).and_then(|c| c.as_os_str().to_str()) {\n                Some(\"version\") => dest = &mut version,\n                Some(\"git-commit-hash\") => dest = &mut git_commit,\n                _ => continue,\n            }\n            let mut buf = String::new();\n            entry.read_to_string(&mut buf)?;\n            *dest = Some(buf);\n\n            // Short circuit to avoid reading the whole tar file if not necessary.","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/tools/build-manifest/src/versions.rs#L237-L273","documentation":"In src/tools/build-manifest/src/versions.rs the tarball reader only recognizes .gz (GzDecoder) and .xz (XzDecoder) extensions. Any other extension (or no extension) falls through to unimplemented!(\"tarball extension not recognized: {}\") at versions.rs:255.","triggerScenarios":"Running build-manifest to extract version/git-commit files from a release tarball whose name does not end in .tar.gz or .tar.xz — e.g. a .tar.zst, .tar.bz2, a plain .tar, or a misnamed file.","commonSituations":"Release pipeline producing .zst tarballs; a manually renamed artifact; a dist that changed compression format without updating build-manifest.","solutions":["Ensure the input tarball uses .tar.gz or .tar.xz compression.","Recompress the artifact: e.g. 'zstd -d f.tar.zst && gzip f.tar' to produce a .gz build-manifest can read.","Extend build-manifest to add a zstd/bzip2 branch if your release now ships those formats.","Check for a missing/empty extension (e.g. a directory passed instead of a tarball)."],"exampleFix":"// before\nlet tar = Archive::new(/* extension is .zst -> panic */);\n\n// after: add zstd support\nuse zstd::Decoder;\nlet decoder = if ext == \"zst\" { Box::new(Decoder::new(file)?) } else { /* gz/xz */ };","handlingStrategy":"validation","validationCode":"fn is_supported_tarball(path: &Path) -> bool {\n    matches!(path.extension().and_then(|e| e.to_str()), Some(\"gz\") | Some(\"xz\"))\n}\n// Only pass tarballs where is_supported_tarball returns true to the version reader.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep release tarballs as .tar.gz or .tar.xz for build-manifest.","Recompress .zst/.bz2 artifacts before invoking build-manifest.","Extend the extension match when you change the release compression."],"tags":["build-manifest","release-tool","tarball","compression","release"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}