tonhowtf/omniget · error · anyhow::Error
Downloaded pdfium archive is too small
Error message
Downloaded pdfium archive is too small ({} bytes) — likely an error page What it means
After a successful HTTP status, ensure_pdfium_with_variant() sanity-checks the downloaded byte count: archives smaller than 100,000 bytes are rejected because real pdfium archives are always far larger — a small payload is almost certainly an HTML error page or a stub response that slipped through with a 200 status.
Solutions
- Inspect what the endpoint actually returns (curl the URL) — usually an HTML error/challenge page
- Bypass or correctly configure the proxy/captive portal and retry
- Use the global proxy configuration (apply_global_proxy) to point at a working proxy
- Install pdfium from a local archive via set_pdfium_from_path instead of downloading
Defensive patterns
Strategy: try-catch
Validate before calling
let resp = client.get(&probe_url).send().await?;
let ct = resp.headers().get(reqwest::header::CONTENT_TYPE);
if let Some(ct) = ct {
if ct.to_str().unwrap_or("").starts_with("text/html") {
eprintln!("endpoint returned HTML — captive portal or error page");
}
} Try / catch
match ensure_pdfium().await {
Err(e) if e.to_string().contains("too small") => {
// network intercepted: switch network/proxy, then retry
}
other => other.map(|_| ()),
} Prevention
- Check Content-Type before trusting a 200 response from download endpoints
- Detect and handle captive portals before first-run downloads
- Fall back to set_pdfium_from_path with a bundled archive when downloads look intercepted
When it happens
Trigger: The server returns HTTP 200 but the body is tiny: a captive-portal/proxy HTML page, an API rate-limit JSON message, or a truncated download.
Common situations: Wi-Fi captive portals intercepting the first request; anti-bot/CDN challenge pages served with 200; misconfigured corporate proxies returning an error page; extremely truncated transfer.
Related errors
- Downloaded file from
- Failed to download pdfium from
- download falhou: HTTP
- download de falhou: HTTP
- Torrent download failed
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/4ca6bda5d1b6ca0b.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/pdfium.rs:188
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>> {
extract_pdfium_archive(&bytes, &target_path_clone, &target_dir_clone, &lib_name)
})
.await
.map_err(|e| anyhow!("spawn_blocking failed: {}", e))??;
if let Some(version_marker) = pdfium_version_marker_path() {
let base = extracted_version.unwrap_or_else(|| "latest".to_string());
let value = format!("{} ({})", base, archive_name);View on GitHub (pinned to 8600b91f42)