run-llama/liteparse · error
failed to extract pdfium archive
Error message
failed to extract pdfium archive
What it means
After creating the temp dir, download_pdfium unpacks the downloaded tar/zip archive into it with the `tar` crate's unpack, panicking with this message on failure. Failures here mean the archive is corrupt, truncated, or in an unsupported format (e.g. a failed download that saved an HTML error page, or a platform archive variant the extractor can't read).
Solutions
- Delete the cached/partial download in the pdfium cache dir and rebuild to force a fresh download.
- Check network/proxy: ensure the pdfium release URL is reachable and not intercepted (curl the URL and inspect the response).
- Verify the archive manually (tar -tf / unzip -l) to confirm integrity and format.
- Retry the build after a transient network failure; if behind a proxy, configure HTTPS_PROXY properly.
Example fix
# before: corrupt cached archive $ cargo build ... panicked: failed to extract pdfium archive # after: purge cache and retry $ rm -rf ~/.cache/liteparse/pdfium* $ unset HTTP_PROXY HTTPS_PROXY # or fix proxy config $ cargo build
Defensive patterns
Strategy: retry
Validate before calling
# Verify the archive downloads intact before building
curl -fSL -o /tmp/pdfium.tar.gz "$PDFIUM_URL" && tar -tzf /tmp/pdfium.tar.gz > /dev/null || { echo "bad download"; exit 1; } Try / catch
# Build wrapper: retry once after clearing a failed extraction for i in 1 2; do cargo build && break rm -rf ~/.cache/liteparse/pdfium* done
Prevention
- Clear the pdfium cache after any network hiccup
- Bypass/fix intercepting proxies for release-download URLs
- Verify archive integrity with tar -t / unzip -l when debugging
- Retry transient download failures with fresh cache
When it happens
Trigger: Running `cargo build` where pdfium-sys downloads a pdfium release archive and unpack fails: network proxy/captive portal returned an HTML error page saved as the archive, the download was truncated, the tar contains unsupported entry types (symlinks/hardlinks on Windows), or the archive format doesn't match the expected one.
Common situations: Corporate proxies intercepting the download URL; flaky networks mid-download; GitHub releases changing their archive layout; restrictive sandboxes that strip symlink entries from the tarball.
Related errors
- failed to create temp dir
- USERPROFILE env var not set
- HOME env var not set
- failed to move pdfium to cache dir
- WASI proc_exit called with code
AI-assisted analysis of run-llama/liteparse@22d2dd8cd7 (2026-09-08).
Data as JSON: /api/errors/c7ad83d64f67936a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pdfium-sys/build.rs:188
eprintln!("pdfium-sys: GET {url}");
let response = ureq::get(&url).call().unwrap_or_else(|e| {
panic!("failed to download pdfium from {url}: {e}");
});
let reader = response.into_body().into_reader();
let gz = flate2::read::GzDecoder::new(reader);
let mut archive = tar::Archive::new(gz);
// Extract to a temp dir first, then rename atomically
let tmp = dest.with_extension("tmp");
if tmp.exists() {
fs::remove_dir_all(&tmp).ok();
}
fs::create_dir_all(&tmp).expect("failed to create temp dir");
archive
.unpack(&tmp)
.expect("failed to extract pdfium archive");
// Fix dylib install name on macOS so @rpath resolution works
fix_dylib_install_name(&tmp);
// Atomic rename into place
if dest.exists() {
fs::remove_dir_all(dest).ok();
}
fs::rename(&tmp, dest).expect("failed to move pdfium to cache dir");
eprintln!("pdfium-sys: cached pdfium at {}", dest.display());
}
/// On macOS, pdfium-binaries ships dylibs with install name `./libpdfium.dylib`.
/// We need `@rpath/libpdfium.dylib` for rpath resolution to work.
fn fix_dylib_install_name(dir: &Path) {
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
if target_os != "macos" {View on GitHub (pinned to 22d2dd8cd7)