tonhowtf/omniget · error

Failed to download yt-dlp: HTTP

Error message

Failed to download yt-dlp: HTTP {}

What it means

`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.

Solutions

  1. Retry later — GitHub/CDN outages and rate limits are often transient.
  2. Check network/proxy configuration; allow access to github.com (or the configured release host).
  3. Verify the release/asset URL still exists in a browser and update the pinned release/asset name if changed.
  4. If rate-limited (403/429), wait or authenticate requests; check response.status in the message for the exact code.
  5. As a workaround, install yt-dlp manually on PATH so the download path is never taken.
Defensive patterns

Strategy: retry

Validate before calling

let url_ok = reqwest::Client::new()
    .head(&download_url).send().await
    .map(|r| r.status().is_success()).unwrap_or(false);
if !url_ok { eprintln!("asset URL unreachable; check network/proxy"); }

Try / catch

for attempt in 0..3 {
    match download_ytdlp_binary().await {
        Ok(p) => break p,
        Err(e) if attempt < 2 && e.to_string().contains("Failed to download yt-dlp: HTTP") => {
            tokio::time::sleep(std::time::Duration::from_secs(5 * (attempt + 1))).await;
        }
        Err(e) => return Err(e),
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/c7bcb99650b257a4. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/ytdlp.rs:1857

async fn download_ytdlp_asset(asset: &str, target: PathBuf) -> anyhow::Result<PathBuf> {
    if let Some(parent) = target.parent() {
        std::fs::create_dir_all(parent)?;
    }

    let channel = ytdlp_channel();
    let base = ytdlp_release_base(channel);
    let download_url = format!("{}/{}", base, asset);
    let sums_url = format!("{}/SHA2-256SUMS", base);

    let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
        .timeout(std::time::Duration::from_secs(120))
        .build()?;

    let response = client.get(&download_url).send().await?;

    if !response.status().is_success() {
        return Err(anyhow!(
            "Failed to download yt-dlp: HTTP {}",
            response.status()
        ));
    }

    let bytes = response.bytes().await?;

    // Verify against the release's published checksums. Fail closed on a
    // mismatch; fail open only when the sums file itself can't be fetched, so
    // a transient GitHub hiccup doesn't block downloads entirely.
    // Fail-closed. O yt-dlp publica `SHA2-256SUMS` em toda release; não
    // conseguir buscá-lo é indistinguível de alguém suprimindo a verificação,
    // então o binário é descartado em vez de instalado sem conferência.
    let expected = integrity::expected_from_sums_url(&client, &sums_url, asset)
        .await
        .map_err(|e| anyhow!("yt-dlp: verificacao de integridade impossivel — {}", e))?;
    integrity::verify_sha256(&bytes, &expected, &format!("yt-dlp ({:?})", channel))?;

View on GitHub (pinned to 8600b91f42)