{"record":{"id":"bd2d0d47e9d0be63","repo":"tonhowtf/omniget","slug":"not-found-inside-pdfium-archive","errorCode":null,"errorMessage":"{} not found inside pdfium archive","messagePattern":"(.+?) not found inside pdfium archive","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/pdfium.rs","lineNumber":299,"sourceCode":"            entry.read_to_end(&mut buf)?;\n            let tmp = target_dir.join(format!(\".{}.tmp\", lib_filename));\n            std::fs::write(&tmp, &buf)\n                .with_context(|| format!(\"writing temp pdfium lib {}\", tmp.display()))?;\n            if target_path.exists() {\n                let _ = std::fs::remove_file(target_path);\n            }\n            std::fs::rename(&tmp, target_path)\n                .with_context(|| format!(\"moving pdfium to {}\", target_path.display()))?;\n            found_lib = true;\n        } else if file_name == \"VERSION\" {\n            let mut buf = String::new();\n            entry.read_to_string(&mut buf)?;\n            version = Some(buf.trim().to_string());\n        }\n    }\n\n    if !found_lib {\n        return Err(anyhow!(\"{} not found inside pdfium archive\", lib_filename));\n    }\n\n    Ok(version)\n}\n","sourceCodeStart":281,"sourceCodeEnd":304,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/pdfium.rs#L281-L304","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nif entry.name() == lib_filename { ... }\n// after\nlet is_lib = entry.name() == lib_filename\n    || entry.name().starts_with(\"libpdfium.so\");\nif is_lib { ... }","handlingStrategy":"validation","validationCode":"use std::io::Read;\nlet f = std::fs::File::open(&archive_path)?;\nlet mut zip = zip::ZipArchive::new(f)?;\nlet has_lib = (0..zip.len())\n    .any(|i| zip.by_index(i).map(|e| e.name().ends_with(\"pdfium.dll\") || e.name().contains(\"libpdfium\")).unwrap_or(false));\nif !has_lib { eprintln!(\"archive has no pdfium library entry\"); }","typeGuard":null,"tryCatchPattern":"match ensure_pdfium().await {\n    Err(e) if e.to_string().contains(\"not found inside pdfium archive\") => {\n        // archive layout changed upstream: re-download correct platform archive or update matchers\n    }\n    other => other.map(|_| ()),\n}","preventionTips":["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)"],"tags":["archive","pdfium","extraction","validation"],"backgroundTag":"resource-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}