Common errors, their causes, and how to fix them.
Every error the SDK returns carries a stable code and a link to this section. The code does not change between releases, so it is safe to branch on.
Error::Io
Underlying I/O operation failed.
Check that the file path is accessible and the process has read/write permissions. Inspect `source` for the underlying OS error.
Error::FileNotFound
File not found at the given path.
Verify the path exists before calling. Use `Path::exists()` or handle this variant to prompt the user for the correct path.
Error::InvalidPdf
PDF is structurally invalid.
Ensure the bytes are a complete, undamaged PDF. Check `byte_offset` for the failure site. Re-download or re-export the file if corrupt.
Error::UnsupportedPdfVersion
PDF version is newer than the supported maximum.
The PDF version header exceeds what this build supports. Upgrade to a newer PDFluent release, or pre-process the file with a downgrader.
Error::PdfaValidationFailed
PDF/A validation failed against the requested profile.
Inspect `violations` for specific rule identifiers. Use `OpenOptions::convert_to_pdfa()` to auto-repair, or fix the source document before validation.
Error::DecryptionFailed
Decryption failed — wrong password or unsupported algorithm.
Supply the correct password via `OpenOptions::password()`. Check `reason` to distinguish wrong-password from unsupported-algorithm cases.
Error::InvalidSignature
A digital signature is invalid.
The signature in `field` failed verification. Check `reason` for details. Do not trust the document content if integrity is required.
Error::UnsupportedOnWasm
Operation is not supported in WebAssembly builds.
This operation (`operation`) cannot run in a WASM32 environment. Use the server-side API or guard with `#[cfg(not(target_arch = "wasm32"))]`.
Error::TextEditFailed
A text-edit transaction failed (see [`crate::text_edit`] for the typed per-edit errors this message summarizes).
The message carries the typed reason from the edit session. A stale or invalid match id means the document changed after the search: search again and stage against the new matches. `unsupported container` and `match spans multiple styles` mean the text cannot be edited in place -- redact and re-draw it instead. Overlapping or duplicated stages are a mistake in the caller's own batch.
Error::MissingDependency
A native dependency is required but not installed or discoverable.
Install the missing native library (`dep`) following `install_hint`. Ensure the library is on `LD_LIBRARY_PATH` / `DYLD_LIBRARY_PATH`.
Error::MemoryBudgetExceeded
Memory budget set via [`crate::OpenOptions::strict_memory_limit`] exceeded.
Raise the memory limit via `OpenOptions::strict_memory_limit()`, or process the document in smaller chunks.
Error::ResourceLimitExceeded
A processing limit you configured was exceeded while loading or working on the document. The `kind` field says which one.
Inspect `kind` to identify which cap fired, then raise the corresponding `ProcessingLimits` field. For untrusted input, keep limits tight and reject oversized files at the ingestion layer.
Error::PageOutOfRange
A page number outside the document was asked for. Pages are numbered from 1, so 0 is never valid -- it is the number a caller arriving from a 0-based API reaches for first.
Pass a page number between 1 and `page_count()` inclusive. If you are porting from a 0-based API, add 1.
Error::PageRangeInvalid
A page range the document cannot satisfy was asked for: it runs past the last page, starts at 0, or ends before it starts.
Pass a range that lies inside 1..=`page_count()` and does not end before it starts. If you are porting from a 0-based API, add 1 to both ends; `0..n` becomes `1..=n`.
Error::Unsupported
The requested operation is not supported for this document or in this build.
Read the message: it names what was asked for. Either the document lacks the structure the operation needs, or the capability is not part of this build.
Error::Internal
Internal safety-net. Should never fire under normal operation.
This should never occur under normal operation. File a bug report at https://pdfluent.com/support including `message` and `crate_version`.