{"record":{"id":"a31a1589b01b140d","repo":"GitoxideLabs/gitoxide","slug":"format-for-extension-ext-is-unsupported","errorCode":null,"errorMessage":"Format for extension '{ext}' is unsupported","messagePattern":"Format for extension '(.+?)' is unsupported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/archive.rs","lineNumber":106,"sourceCode":"        }\n        gix::object::Kind::Tree => (None, object.id),\n        gix::object::Kind::Tag => fetch_rev_info(object.peel_to_kind(gix::object::Kind::Commit)?)?,\n        gix::object::Kind::Blob => bail!(\"Cannot derive commit or tree from blob at {}\", object.id),\n    })\n}\n\nfn format_from_ext(path: &Path) -> anyhow::Result<archive::Format> {\n    Ok(match path.extension().and_then(std::ffi::OsStr::to_str) {\n        None => bail!(\"Cannot derive archive format from a file without extension\"),\n        Some(\"tar\") => archive::Format::Tar,\n        Some(\"gz\") => archive::Format::TarGz {\n            compression_level: None,\n        },\n        Some(\"zip\") => archive::Format::Zip {\n            compression_level: None,\n        },\n        Some(\"stream\") => archive::Format::InternalTransientNonPersistable,\n        Some(ext) => bail!(\"Format for extension '{ext}' is unsupported\"),\n    })\n}\n","sourceCodeStart":88,"sourceCodeEnd":109,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/archive.rs#L88-L109","documentation":"`format_from_ext` supports only the extensions tar, gz, zip, and stream. Any other extension causes a bail naming the unsupported extension. This is a whitelist of explicitly implemented archive formats.","triggerScenarios":"Calling `archive::stream` with an output file whose extension is anything outside {tar, gz, zip, stream}, e.g. `out.tgz`, `out.tar.zst`, `out.bz2`, `out.rar`.","commonSituations":"Users typing `.tgz` or `.tar.gz` expecting gzip support; requesting zstd/bzip2 compression not yet implemented; scripts defaulting to `.7z`.","solutions":["Rename the output to an exact supported extension: `.tar`, `.gz`, `.zip`, or `.stream`","Use `.tar.gz` -> not supported; instead write to `.gz` (TarGz) per the implementation","Add post-processing (e.g. pipe the tar output through zstd) outside of gix for other compressions","Check `archive::Format` for the currently supported set before choosing a filename"],"exampleFix":"// before\nlet out = Path::new(\"release.tgz\");\n// after\nlet out = Path::new(\"release.gz\"); // TarGz","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[&str] = &[\"tar\", \"gz\", \"zip\", \"stream\"];\nlet ext = path.extension().and_then(|e| e.to_str()).unwrap_or(\"\");\nanyhow::ensure!(SUPPORTED.contains(&ext), \"extension '{ext}' unsupported; use one of {SUPPORTED:?}\");","typeGuard":null,"tryCatchPattern":"match format_from_ext(path) {\n    Err(e) if e.to_string().contains(\"is unsupported\") => {\n        eprintln!(\"use .tar, .gz, .zip or .stream\");\n    }\n    other => other?,\n}","preventionTips":["Map user-friendly names (.tgz, .tar.gz) to supported extensions before calling archive","Consult `archive::Format` for the implemented format list","Handle other compressions (zstd, bz2) outside gix via post-processing"],"tags":["git","archive","unsupported-format","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}