tonhowtf/omniget · error · anyhow::Error
Failed to download pdfium from
Error message
Failed to download pdfium from {}: HTTP {} What it means
When downloading the pdfium archive, ensure_pdfium_with_variant() checks the HTTP status of the response and throws this error for any non-success status. The message includes the full source URL and the numeric HTTP status, so it distinguishes 404 (bad base URL/variant), 403 (rate-limit/blocked), 5xx (server outage), etc.
Solutions
- Read the HTTP status in the message: 404 means fix the URL/archive variant; 403 means auth/proxy issue; 5xx means retry later
- Verify PDFIUM_DOWNLOAD_BASE still points to valid release assets and that the variant name maps to an existing archive
- Retry after checking network/proxy; the request has a 600s timeout so failures are genuine server responses
- Pin a known-good pdfium archive name or install from a local file with set_pdfium_from_path
Example fix
// retry with a fallback variant on 404
match ensure_pdfium_with_variant(Some(variant)).await {
Err(e) if e.to_string().contains("HTTP 404") => ensure_pdfium_with_variant(None).await,
other => other,
} Defensive patterns
Strategy: retry
Validate before calling
let head = client.head(&url).send().await?;
if !head.status().is_success() {
eprintln!("pdfium URL not reachable: {}", head.status());
} Try / catch
match ensure_pdfium().await {
Err(e) if e.to_string().contains("Failed to download pdfium") => {
// inspect HTTP status in message; retry with backoff or pin another release
}
other => other.map(|_| ()),
} Prevention
- Retry transient 5xx with exponential backoff; don't retry 4xx blindly
- Pin a known-good pdfium release/variant instead of floating 'latest'
- Configure the global proxy so downloads work behind corporate networks
When it happens
Trigger: The GET request to PDFIUM_DOWNLOAD_BASE + archive_name returns a non-2xx status: wrong or renamed archive variant, outdated download base URL, offline proxy returning errors, or GitHub/bento release assets moved.
Common situations: New pdfium release renamed the asset so the constructed archive_name 404s; corporate proxy blocks bslashdev/github downloads; transient 502/503 from the CDN.
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
- download falhou: HTTP
- download de falhou: HTTP
- Failed to download attachment
- nao foi possivel buscar
- Failed to download aria2c: HTTP
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/9d8eb37aa3201bb5.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/pdfium.rs:180
let target_dir =
pdfium_target_dir().ok_or_else(|| anyhow!("could not determine app data dir"))?;
std::fs::create_dir_all(&target_dir)
.with_context(|| format!("creating pdfium target dir {}", target_dir.display()))?;
let archive_name = archive_name_for_variant(variant.as_deref());
let url = format!("{}/{}", PDFIUM_DOWNLOAD_BASE, archive_name);
let lib_filename = pdfium_lib_filename();
let target_path = target_dir.join(lib_filename);
tracing::info!("Downloading pdfium from {}", url);
let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
.timeout(std::time::Duration::from_secs(600))
.build()?;
let response = client.get(&url).send().await?;
if !response.status().is_success() {
return Err(anyhow!(
"Failed to download pdfium from {}: HTTP {}",
url,
response.status()
));
}
let bytes = response.bytes().await?.to_vec();
if bytes.len() < 100_000 {
return Err(anyhow!(
"Downloaded pdfium archive is too small ({} bytes) — likely an error page",
bytes.len()
));
}
let target_path_clone = target_path.clone();
let target_dir_clone = target_dir.clone();
let lib_name = lib_filename.to_string();
let extracted_version =
tokio::task::spawn_blocking(move || -> anyhow::Result<Option<String>> {View on GitHub (pinned to 8600b91f42)