tonhowtf/omniget · error · anyhow::Error
not found inside pdfium archive
Error message
{} not found inside pdfium archive What it means
extract_pdfium_archive() walks every entry of the downloaded archive looking for the expected pdfium library filename. If the stream ends without any entry matching lib_filename, it concludes the archive does not contain the library and throws this error naming the expected filename. This guards against archives whose layout changed upstream.
Solutions
- Verify the downloaded archive is for the current platform and contains pdfium_lib_filename() (list its contents)
- Update pdfium_lib_filename()/extraction matching if upstream renamed the library (e.g. match libpdfium.so.* prefixes)
- Re-download the archive — a truncated download may have dropped entries
- Pin a pdfium release known to match the expected layout
Example fix
// before
if entry.name() == lib_filename { ... }
// after
let is_lib = entry.name() == lib_filename
|| entry.name().starts_with("libpdfium.so");
if is_lib { ... } Defensive patterns
Strategy: validation
Validate before calling
use std::io::Read;
let f = std::fs::File::open(&archive_path)?;
let mut zip = zip::ZipArchive::new(f)?;
let has_lib = (0..zip.len())
.any(|i| zip.by_index(i).map(|e| e.name().ends_with("pdfium.dll") || e.name().contains("libpdfium")).unwrap_or(false));
if !has_lib { eprintln!("archive has no pdfium library entry"); } Try / catch
match ensure_pdfium().await {
Err(e) if e.to_string().contains("not found inside pdfium archive") => {
// archive layout changed upstream: re-download correct platform archive or update matchers
}
other => other.map(|_| ()),
} Prevention
- Match library entries by prefix/suffix patterns, not exact names, to survive upstream renames
- Verify the platform variant matches the host OS before download
- Re-download when an archive fails to open or is missing entries (may be truncated)
When it happens
Trigger: The pdfium release changed its internal directory layout or library name so lib_filename (from pdfium_lib_filename()) no longer matches any archive entry; a partial/corrupt archive lost the lib entry; wrong platform archive downloaded.
Common situations: Upstream pdfium release renamed the lib (e.g. versioned .so suffix); downloaded the Windows archive on a Linux expectation; truncated download that skipped the lib entry.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- FFmpeg binary not found after extraction
- o pacote não traz nenhuma biblioteca do ONNX Runtime em lib/
- Downloaded pdfium archive is too small
- source not a file
- No valid cookies found in file (expected Netscape format)
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/bd2d0d47e9d0be63.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/pdfium.rs:299
entry.read_to_end(&mut buf)?;
let tmp = target_dir.join(format!(".{}.tmp", lib_filename));
std::fs::write(&tmp, &buf)
.with_context(|| format!("writing temp pdfium lib {}", tmp.display()))?;
if target_path.exists() {
let _ = std::fs::remove_file(target_path);
}
std::fs::rename(&tmp, target_path)
.with_context(|| format!("moving pdfium to {}", target_path.display()))?;
found_lib = true;
} else if file_name == "VERSION" {
let mut buf = String::new();
entry.read_to_string(&mut buf)?;
version = Some(buf.trim().to_string());
}
}
if !found_lib {
return Err(anyhow!("{} not found inside pdfium archive", lib_filename));
}
Ok(version)
}
View on GitHub (pinned to 8600b91f42)