tonhowtf/omniget · error
Failed to open aria2c zip
Error message
Failed to open aria2c zip: {} What it means
Thrown in download_aria2c when zip::ZipArchive::new cannot parse the downloaded aria2c Windows release archive. The bytes fetched from the GitHub release URL are not a structurally valid ZIP file (bad signature, truncated body, corrupted transfer). The anyhow context preserves the underlying zip crate error message.
Solutions
- Re-run ensure_aria2c / download_aria2c — a truncated download usually succeeds on retry
- Check proxy configuration (apply_global_proxy source) and corporate firewall rules for github.com
- Verify the downloaded bytes: check first bytes for the PK zip signature (0x50 0x4B) and Content-Length before parsing
- Manually download the aria2 zip and place aria2c.exe in the managed bin directory so download is skipped
- Update the pinned release URL if release-1.37.0 was removed or moved
Example fix
// before
let cursor = std::io::Cursor::new(&data);
let mut archive = zip::ZipArchive::new(cursor)
.map_err(|e| anyhow!("Failed to open aria2c zip: {}", e))?;
// after
if data.len() < 4 || &data[..2] != b"PK" {
return Err(anyhow!("Downloaded aria2c payload is not a zip ({} bytes)", data.len()));
}
let cursor = std::io::Cursor::new(&data);
let mut archive = zip::ZipArchive::new(cursor)
.map_err(|e| anyhow!("Failed to open aria2c zip: {}", e))?; Defensive patterns
Strategy: retry
Validate before calling
// Rust: sanity-check payload before extraction
fn looks_like_zip(data: &[u8]) -> bool {
data.len() > 4 && &data[..2] == b"PK" && data.len() > 1024 // avoid HTML error pages
}
if !looks_like_zip(&data) {
eprintln!("downloaded aria2c payload is not a zip; check proxy/network");
} Type guard
fn is_zip_payload(data: &[u8]) -> bool {
data.len() >= 4 && data.starts_with(b"PK\x03\x04")
} Try / catch
match ensure_aria2c().await {
Some(path) => use_aria2c(path),
None => eprintln!("aria2c unavailable: zip open failed; check network/proxy and retry"),
} Prevention
- Validate the PK zip magic bytes and minimum size before parsing the archive
- Apply a checksum (SHA-256) comparison against the official release before extraction
- Set a reasonable timeout and check Content-Length matches the received body
- Keep fallback logic: ensure_aria2c already returns Option — handle None gracefully
- Log response status and body prefix on failure to detect HTML-from-proxy responses
When it happens
Trigger: The HTTP response body downloaded from https://github.com/aria2/aria2/releases/... is not a valid zip: a proxy or captive portal returned an HTML error page, the download was truncated by the 120s timeout, disk/memory corruption, or GitHub returned a redirect/error body with a 2xx status.
Common situations: Corporate proxies intercepting github.com and returning HTML; flaky networks truncating the response; the pinned release URL (release-1.37.0) becoming unavailable and a CDN returning a soft-error 200 page; running behind an HTTP proxy with global proxy settings misconfigured.
Understand the failure class
Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.
Related errors
- Track sem metadata pra resolver no YouTube
- download de falhou: HTTP
- nao foi possivel buscar
- Failed to open zip
- Failed to open Deno zip
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/b80a7f2150be5f08.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/dependencies.rs:911
let response = client.get(url).send().await?;
if !response.status().is_success() {
return Err(anyhow!(
"Failed to download aria2c: HTTP {}",
response.status()
));
}
let bytes = response.bytes().await?;
let data = bytes.to_vec();
let bin_dir_clone = bin_dir.clone();
let aria2c_name_clone = aria2c_name.clone();
tokio::task::spawn_blocking(move || {
let cursor = std::io::Cursor::new(&data);
let mut archive = zip::ZipArchive::new(cursor)
.map_err(|e| anyhow!("Failed to open aria2c zip: {}", e))?;
for i in 0..archive.len() {
let mut file = archive
.by_index(i)
.map_err(|e| anyhow!("Failed to read zip entry: {}", e))?;
let name = file.name().to_string();
if name.ends_with(&aria2c_name_clone) {
let dest = bin_dir_clone.join(&aria2c_name_clone);
let mut buf = Vec::new();
std::io::Read::read_to_end(&mut file, &mut buf)?;
std::fs::write(&dest, &buf)?;
break;
}
}
Ok::<(), anyhow::Error>(())
})View on GitHub (pinned to 8600b91f42)