{"record":{"id":"c7bcb99650b257a4","repo":"tonhowtf/omniget","slug":"failed-to-download-yt-dlp-http","errorCode":null,"errorMessage":"Failed to download yt-dlp: HTTP {}","messagePattern":"Failed to download yt-dlp: HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/ytdlp.rs","lineNumber":1857,"sourceCode":"\nasync fn download_ytdlp_asset(asset: &str, target: PathBuf) -> anyhow::Result<PathBuf> {\n    if let Some(parent) = target.parent() {\n        std::fs::create_dir_all(parent)?;\n    }\n\n    let channel = ytdlp_channel();\n    let base = ytdlp_release_base(channel);\n    let download_url = format!(\"{}/{}\", base, asset);\n    let sums_url = format!(\"{}/SHA2-256SUMS\", base);\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(&download_url).send().await?;\n\n    if !response.status().is_success() {\n        return Err(anyhow!(\n            \"Failed to download yt-dlp: HTTP {}\",\n            response.status()\n        ));\n    }\n\n    let bytes = response.bytes().await?;\n\n    // Verify against the release's published checksums. Fail closed on a\n    // mismatch; fail open only when the sums file itself can't be fetched, so\n    // a transient GitHub hiccup doesn't block downloads entirely.\n    // Fail-closed. O yt-dlp publica `SHA2-256SUMS` em toda release; não\n    // conseguir buscá-lo é indistinguível de alguém suprimindo a verificação,\n    // então o binário é descartado em vez de instalado sem conferência.\n    let expected = integrity::expected_from_sums_url(&client, &sums_url, asset)\n        .await\n        .map_err(|e| anyhow!(\"yt-dlp: verificacao de integridade impossivel — {}\", e))?;\n    integrity::verify_sha256(&bytes, &expected, &format!(\"yt-dlp ({:?})\", channel))?;\n","sourceCodeStart":1839,"sourceCodeEnd":1875,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/ytdlp.rs#L1839-L1875","documentation":"`download_ytdlp_asset` fetches the yt-dlp binary/zipapp from a download URL with a 120s-timeout HTTP client. If the response status is not a success code (404, 403, 5xx, etc.), it aborts with \"Failed to download yt-dlp: HTTP {status}\". This indicates the release asset could not be fetched from the remote host.","triggerScenarios":"GET of the yt-dlp download URL returns a non-2xx status: GitHub release removed/moved, asset renamed, rate-limited (HTTP 403/429), proxy blocking, or CDN outage.","commonSituations":"Corporate proxy or firewall blocking github.com; GitHub API/rate limiting; pinned release URL that no longer exists; DNS hijacking by ISPs; the asset name changed in a newer release layout.","solutions":["Retry later — GitHub/CDN outages and rate limits are often transient.","Check network/proxy configuration; allow access to github.com (or the configured release host).","Verify the release/asset URL still exists in a browser and update the pinned release/asset name if changed.","If rate-limited (403/429), wait or authenticate requests; check response.status in the message for the exact code.","As a workaround, install yt-dlp manually on PATH so the download path is never taken."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"let url_ok = reqwest::Client::new()\n    .head(&download_url).send().await\n    .map(|r| r.status().is_success()).unwrap_or(false);\nif !url_ok { eprintln!(\"asset URL unreachable; check network/proxy\"); }","typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match download_ytdlp_binary().await {\n        Ok(p) => break p,\n        Err(e) if attempt < 2 && e.to_string().contains(\"Failed to download yt-dlp: HTTP\") => {\n            tokio::time::sleep(std::time::Duration::from_secs(5 * (attempt + 1))).await;\n        }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Add exponential backoff around the download call.","Verify proxy settings allow github.com traffic.","Pin to release URLs you verify still exist.","Offer a manual yt-dlp installation path as an escape hatch."],"tags":["http","download","network","yt-dlp","rust"],"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"}