run-llama/liteparse · critical
Couldn't write bindings!
Error message
Couldn't write bindings!
What it means
The pdfium-sys build script panics because bindgen succeeded in generating the bindings but `write_to_file()` failed to write them to `$OUT_DIR/bindings.rs`. This is an I/O failure writing the generated bindings file, raised as a build-time panic that aborts compilation of the crate.
Solutions
- Free disk space in the target/ filesystem or point CARGO_TARGET_DIR at a location with room, then rebuild.
- Check permissions on the OUT_DIR / target directory and ensure the build user can write there (e.g. chown the target dir or rebuild outside the read-only mount).
- Clear the stale/corrupted target dir (`cargo clean`) and rebuild.
- Exclude the target directory from antivirus/monitoring that may lock or remove freshly written files.
Example fix
// before: OUT_DIR unwritable due to disk/permission issue # df -h $CARGO_TARGET_DIR # check space # cargo clean // after: use a writable target dir # CARGO_TARGET_DIR=/tmp/cargo-target cargo build -p pdfium-sys
Defensive patterns
Strategy: validation
Validate before calling
# shell — ensure writable target dir with space before building
test -w "$CARGO_TARGET_DIR" || export CARGO_TARGET_DIR=/tmp/cargo-target
df --output=avail -h "$CARGO_TARGET_DIR" | awk 'NR==2 && $1+0 < 1048576 {print "low disk"; exit 1}' Prevention
- Monitor disk space on CI runners; cargo clean stale targets regularly
- Keep CARGO_TARGET_DIR on a writable, non-read-only filesystem
- Exclude target/ from antivirus and container volume mounts with sync/locking quirks
- Run builds as a user with write access to the target directory
When it happens
Trigger: Building pdfium-sys with the `bindgen` feature while the OUT_DIR path is unwritable or missing: full disk, restrictive permissions, another process/antivirus locking the file, OUT_DIR removed mid-build, or an invalid/oversized target directory path.
Common situations: CI runners with read-only or quota-exhausted target directories; Docker containers running the build as a non-root user without write access to CARGO_TARGET_DIR; disk-full during large builds; security software deleting generated files.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Unable to generate bindings
- no data on stdin (input `-` expects a document piped in…
- no data on stdin (input `-` expects a document piped in…
- invalid zero-sized RGB image
- RGB image dimensions overflow
AI-assisted analysis of run-llama/liteparse@22d2dd8cd7 (2026-09-08).
Data as JSON: /api/errors/102d35e4f970a975.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pdfium-sys/build.rs:290
.allowlist_function("FORM_.*")
.allowlist_function("FPDFText_.*")
.allowlist_function("FPDFPage.*")
.allowlist_function("FPDFLink_.*")
.allowlist_function("FPDFFont_.*")
.allowlist_type("FPDF.*")
.allowlist_type("FS_.*")
.allowlist_var("FPDF.*")
.allowlist_var("FLAT.*")
.derive_debug(true)
.derive_default(true)
.layout_tests(false)
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
bindings
.write_to_file(&out_file)
.expect("Couldn't write bindings!");
}
#[cfg(not(feature = "bindgen"))]
{
let _ = include_dir;
let pregenerated = Path::new(env!("CARGO_MANIFEST_DIR")).join("bindings.rs");
fs::copy(&pregenerated, &out_file).unwrap_or_else(|e| {
panic!(
"Failed to copy pre-generated bindings from {}: {e}",
pregenerated.display()
)
});
}
}
View on GitHub (pinned to 22d2dd8cd7)