tonhowtf/omniget · error
zip invalido
Error message
zip invalido: {} What it means
`unpack_zip` extracts a downloaded ZIP (Windows Spicetify CLI) using the `zip` crate. If the bytes cannot be opened as a ZIP archive at all — corrupt download, HTML error page saved instead, or truncated file — it fails with this error wrapping the underlying zip error.
Solutions
- Delete the downloaded file and re-download (preferably with the digest verification intact)
- Check the first bytes of the data — `PK\x03\x04` means a real ZIP; HTML/`<!DOCTYPE` means a proxy or error page was captured
- Bypass any corporate proxy/captive portal and retry the download
- Confirm the asset URL points to the actual binary asset, not a redirect/error page
Example fix
// before
let data = std::fs::read(&cached_path)?;
unpack_zip(&data, &dest)?;
// after
let data = std::fs::read(&cached_path)?;
if !data.starts_with(b"PK\x03\x04") {
std::fs::remove_file(&cached_path)?; // clear corrupt cache
let data = download_verified(&client, &asset).await?;
}
unpack_zip(&data, &dest)?; Defensive patterns
Strategy: validation
Validate before calling
fn looks_like_zip(data: &[u8]) -> bool { data.starts_with(b"PK\x03\x04") }
// call before unpack_zip:
if !looks_like_zip(&data) { re_download().await?; } Type guard
fn is_zip(data: &[u8]) -> bool { data.len() > 4 && data.starts_with(b"PK\x03\x04") } Try / catch
match unpack_zip(&data, &dest) {
Err(e) if e.to_string().contains("zip invalido") => {
let fresh = download_verified(&client, &asset).await?;
unpack_zip(&fresh, &dest)
}
other => other,
} Prevention
- Verify the download digest before caching/unpacking
- Check the ZIP magic bytes before extraction and re-download on mismatch
- Avoid proxies/captive portals during downloads; detect HTML responses early
- Delete stale cached archives before retrying
When it happens
Trigger: `unpack_zip(data, dest)` where `ZipArchive::new` fails: response bytes are an error page/proxy HTML instead of a ZIP, download truncated, or file stored corrupted on disk.
Common situations: Captive portal/proxy injecting HTML into the download; partial download from an interrupted connection; serving the wrong file due to a mis-templated URL.
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
- Failed to open zip
- zip invalido
- FFmpeg binary not found after extraction
- Failed to open archive
- Failed to read zip entry
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/12cc58bb59184bc0.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/spicetify.rs:468
}
} else if cfg!(target_os = "macos") {
if cfg!(target_arch = "aarch64") {
"darwin-arm64.tar.gz"
} else {
"darwin-amd64.tar.gz"
}
} else if cfg!(target_arch = "x86_64") {
"linux-amd64.tar.gz"
} else {
return Err(anyhow!(
"o Spicetify nao publica binario para Linux nesta arquitetura; instale pelo gerenciador de pacotes"
));
})
}
fn unpack_zip(data: &[u8], dest: &Path) -> anyhow::Result<()> {
let mut archive = zip::ZipArchive::new(std::io::Cursor::new(data))
.map_err(|e| anyhow!("zip invalido: {}", e))?;
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
let Some(rel) = file.enclosed_name() else {
continue;
};
let out = dest.join(rel);
if file.is_dir() {
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(())
}View on GitHub (pinned to 8600b91f42)