{"record":{"id":"e097bca33f1a8225","repo":"tonhowtf/omniget","slug":"failed-to-download-aria2c-http","errorCode":null,"errorMessage":"Failed to download aria2c: HTTP {}","messagePattern":"Failed to download aria2c: HTTP (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/dependencies.rs","lineNumber":896,"sourceCode":"}\n\n#[cfg(target_os = \"windows\")]\nasync fn download_aria2c() -> anyhow::Result<PathBuf> {\n    let bin_dir = managed_bin_dir().ok_or_else(|| anyhow!(\"Could not determine data directory\"))?;\n    std::fs::create_dir_all(&bin_dir)?;\n\n    let aria2c_name = bin_name(\"aria2c\");\n    let aria2c_target = bin_dir.join(&aria2c_name);\n\n    let url = \"https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip\";\n\n    let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())\n        .timeout(std::time::Duration::from_secs(120))\n        .build()?;\n\n    let response = client.get(url).send().await?;\n    if !response.status().is_success() {\n        return Err(anyhow!(\n            \"Failed to download aria2c: HTTP {}\",\n            response.status()\n        ));\n    }\n\n    let bytes = response.bytes().await?;\n\n    let data = bytes.to_vec();\n    let bin_dir_clone = bin_dir.clone();\n    let aria2c_name_clone = aria2c_name.clone();\n\n    tokio::task::spawn_blocking(move || {\n        let cursor = std::io::Cursor::new(&data);\n        let mut archive = zip::ZipArchive::new(cursor)\n            .map_err(|e| anyhow!(\"Failed to open aria2c zip: {}\", e))?;\n\n        for i in 0..archive.len() {\n            let mut file = archive","sourceCodeStart":878,"sourceCodeEnd":914,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/dependencies.rs#L878-L914","documentation":"download_aria2c fetches the aria2 release ZIP from GitHub. As with gallery-dl, a non-success HTTP status on the GET response aborts with 'Failed to download aria2c: HTTP {}'. The pinned URL is a specific aria2 1.37.0 Windows 64-bit release asset.","triggerScenarios":"The GET to the aria2 GitHub release URL returns non-2xx: GitHub rate limiting (403/429), the pinned release asset moved or deleted (404), proxy/firewall interception, or GitHub returning 5xx during an outage.","commonSituations":"Corporate proxy blocking github.com release downloads; heavy CI usage hitting GitHub's unauthenticated rate limits; the aria2 release URL breaking after an upstream release re-tag; transient GitHub 502/503 errors.","solutions":["Check the reported HTTP status and fetch the URL manually to confirm availability","If 404, update the pinned aria2 release URL in dependencies.rs to a current valid release asset","If 403/429, wait and retry, or configure a proxy via apply_global_proxy that isn't rate-limited","Pre-provision aria2c in managed_bin_dir so ensure_aria2c skips the download entirely","Add retry-with-backoff around the download for transient 5xx"],"exampleFix":"// before\nlet response = client.get(url).send().await?;\nif !response.status().is_success() {\n    return Err(anyhow!(\"Failed to download aria2c: HTTP {}\", response.status()));\n}\n// after\nlet response = client.get(url).send().await?;\nif !response.status().is_success() {\n    let status = response.status();\n    if status.as_u16() >= 500 || status == reqwest::StatusCode::TOO_MANY_REQUESTS {\n        tokio::time::sleep(std::time::Duration::from_secs(5)).await;\n        // retry once before failing\n    }\n    return Err(anyhow!(\"Failed to download aria2c: HTTP {}\", status));\n}","handlingStrategy":"retry","validationCode":"let url = \"https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip\";\nif let Ok(resp) = reqwest::Client::new().head(url).send().await {\n    if !resp.status().is_success() {\n        return Err(anyhow!(\"aria2c release URL returned HTTP {} — update the pinned URL\", resp.status()));\n    }\n}","typeGuard":null,"tryCatchPattern":"match ensure_aria2c().await {\n    Some(p) => Some(p),\n    None => {\n        log::warn!(\"aria2c download failed (HTTP error); checking system PATH fallback\");\n        which::which(\"aria2c\").ok()\n    }\n}","preventionTips":["Pin to a release URL and validate it still returns 200 in CI or at startup","Cache the downloaded zip/binary and skip re-download when the version matches","Configure a working proxy for restricted networks via apply_global_proxy","Back off and retry on 429/5xx instead of failing the first attempt"],"tags":["network","http","download","windows"],"backgroundTag":"http-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}