tonhowtf/omniget · error · anyhow::Error

probe returned HTTP

Error message

probe returned HTTP {}

What it means

probe_remote requires the ranged GET to return a success (2xx) status. Any non-success status — 403/404/405/500 etc. — is surfaced as `probe returned HTTP {status}` including the status code. Since HEAD succeeded earlier, this often reveals that the GET path is treated differently (e.g. HEAD allowed but GET forbidden).

Solutions

  1. Read the status code in the message and look it up for the specific meaning (403 vs 404 vs 5xx).
  2. Re-check the URL in a browser/curl to confirm the resource still exists and is public.
  3. Add required auth headers/cookies — the probe forwards custom headers via headers_without_range, so supply them at the call site.
  4. If the server lacks range support (416/405), it cannot be used for chunked download; fall back to single-stream download.
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: issue the same ranged GET yourself and check status
let r = reqwest::get(format!("{url}")).await?;
// or check with headers attached as the library would:
// reqwest::Client::new().get(url).header("Range", "bytes=0-0")
let ok = r.status().is_success();

Try / catch

match probe(url, headers, timeout).await {
    Err(e) if e.to_string().starts_with("probe returned HTTP ") => {
        let code: u16 = /* parse status from message */;
        match code { 401 | 403 => /* add/refresh auth headers */, 404 => /* URL dead */, _ => /* server issue */ }
    }
    other => { other?; }
}

Prevention

When it happens

Trigger: The bytes=0-0 GET response's resp.status() is not is_success(): 404 (URL gone), 403 (blocked), 405 (Range/method mishandling), 416 or 5xx from the origin.

Common situations: Hot-link protection / WAF rules returning 403, expired or moved download URLs returning 404, servers lacking range support returning 416, or origin 5xx during load.

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/8ea79cc1b7d1172a. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/http_fetcher.rs:724

                    .map(|s| s.to_string()),
                filename: header_filename(h),
                method: "HEAD",
            });
        }
    }

    let mut req = client.get(url).header(reqwest::header::RANGE, "bytes=0-0");
    if let Some(h) = headers {
        req = req.headers(headers_without_range(h));
    }
    let resp = match tokio::time::timeout(timeout, req.send()).await {
        Ok(Ok(r)) => r,
        Ok(Err(e)) => return Err(anyhow!("probe failed: {}", e)),
        Err(_) => return Err(anyhow!("probe timed out")),
    };
    let status = resp.status();
    if !status.is_success() {
        return Err(anyhow!("probe returned HTTP {}", status));
    }
    let h = resp.headers().clone();
    let content_type = h
        .get(reqwest::header::CONTENT_TYPE)
        .and_then(|v| v.to_str().ok())
        .map(|s| s.to_string());
    let filename = header_filename(&h);
    let probe = if status == reqwest::StatusCode::PARTIAL_CONTENT {
        RemoteProbe {
            content_length: content_range_total(&h),
            accept_ranges: true,
            content_type,
            filename,
            method: "GET range",
        }
    } else {
        RemoteProbe {
            content_length: header_content_length(&h),

View on GitHub (pinned to 8600b91f42)