tonhowtf/omniget · error
tar.gz invalido
Error message
tar.gz invalido: {} What it means
`unpack_tar_gz` gunzips and extracts the downloaded tarball (Linux/macOS Spicetify CLI) with flate2 + tar. If decompression or extraction fails — bad gzip magic, truncated data, invalid tar structure, or an unwritable destination — the error is wrapped as this message. Note the same message covers destination I/O errors too, not just malformed archives.
Solutions
- Re-download the tarball and verify the digest before unpacking
- Check the first two bytes — `\x1f\x8b` is gzip; HTML/text means the download captured an error page
- Ensure `dest` exists, is a directory, and is writable (`mkdir -p`, check permissions)
- Check free disk space and that no file inside the archive is locked by another process
Example fix
// before
unpack_tar_gz(&data, &dest)?;
// after
if !data.starts_with(&[0x1f, 0x8b]) {
anyhow::bail!("download is not gzip (proxy/error page?) — re-download");
}
std::fs::create_dir_all(&dest)?;
unpack_tar_gz(&data, &dest)?; Defensive patterns
Strategy: validation
Validate before calling
fn looks_like_gzip(data: &[u8]) -> bool { data.starts_with(&[0x1f, 0x8b]) }
// call before unpack_tar_gz:
std::fs::create_dir_all(&dest)?;
if !looks_like_gzip(&data) { re_download().await?; } Type guard
fn is_gzip(data: &[u8]) -> bool { data.len() > 2 && data[0] == 0x1f && data[1] == 0x8b } Try / catch
match unpack_tar_gz(&data, &dest) {
Err(e) if e.to_string().contains("tar.gz invalido") => {
std::fs::create_dir_all(&dest)?; // rule out missing dest
let fresh = download_verified(&client, &asset).await?;
unpack_tar_gz(&fresh, &dest)
}
other => other,
} Prevention
- Verify the gzip magic bytes and digest before unpacking
- Ensure the destination directory exists and is writable before extraction
- Re-download on mismatch — the error often means an HTML error page was captured
- Check free disk space for large archives
When it happens
Trigger: `unpack_tar_gz(data, dest)` where GzDecoder/archive.unpack fails: non-gzip bytes (HTML error page), truncated download, corrupted tar entries, or `dest` missing/unwritable.
Common situations: Proxy injecting HTML into the download; interrupted download; extracting into a directory that was deleted or has wrong permissions; disk full.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- tar.gz invalido
- tar.xz invalido
- FFmpeg binary not found after extraction
- Failed to open archive
- Failed to open zip
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/5dd12cd18e1186cf.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/spicetify.rs:494
std::fs::create_dir_all(&out)?;
continue;
}
if let Some(parent) = out.parent() {
std::fs::create_dir_all(parent)?;
}
let mut w = std::fs::File::create(&out)?;
std::io::copy(&mut file, &mut w)?;
}
Ok(())
}
fn unpack_tar_gz(data: &[u8], dest: &Path) -> anyhow::Result<()> {
let decoder = flate2::read::GzDecoder::new(std::io::Cursor::new(data));
let mut archive = tar::Archive::new(decoder);
archive.set_preserve_permissions(true);
archive
.unpack(dest)
.map_err(|e| anyhow!("tar.gz invalido: {}", e))?;
Ok(())
}
#[cfg(unix)]
fn make_executable(path: &Path) {
use std::os::unix::fs::PermissionsExt;
let _ = std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755));
}
#[cfg(not(unix))]
fn make_executable(_path: &Path) {}
/// Baixa o último release do CLI para `<app_data>/bin/spicetify-cli/`.
/// A pasta antiga só sai depois que a nova está inteira no disco.
pub async fn install() -> anyhow::Result<PathBuf> {
if dependencies::is_flatpak() {
return Err(anyhow!(
"dentro do Flatpak o Spicetify nao consegue alterar o Spotify do sistema"View on GitHub (pinned to 8600b91f42)