flxzt/rnote · error
Showing page failed while exporting page
Error message
Showing page failed while exporting page {i} as pdf, Err: {e:?} What it means
Error wrapper around File::open in load_sound_from_path: opening `<resource_path>/<sound_name>.<ending>` failed (missing asset, wrong path, or permission error) while loading a bundled sound for the audio player. The path was checked with exists() just before, so the failure is typically permissions or a race.
Solutions
- Inspect the error variant e: cairo Error::SurfaceFinished means the pdf target surface was finished before drawing — keep the surface alive and do not use the cairo context after finish_output_stream()/flush.
- Retry the export once with a freshly created cairo surface and context; transient surface/IO failures typically resolve on a new target.
- Verify the failing page's content: render pages one by one (or into an intermediate surface) to isolate a page whose draw_to_cairo fails, and check for degenerate page_bounds values (NaN/zero-size) from bounds().
- If running headless/CI, confirm a usable cairo rendering backend and required fonts are installed; missing fontconfig can make show/draw calls fail.
- Update/verify cairo and pango crate versions match the system cairo library; mismatched native libs cause drawing failures mid-export.
When it happens
Trigger: Thrown at crates/rnote-engine/src/engine/export.rs:515 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08).
Data as JSON: /api/errors/03a1138a5c75d3fe.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-engine/src/engine/export.rs:515
let cairo_cx = cairo::Context::new(&target_surface)
.context("Creating new cairo context for pdf target surface failed.")?;
for (i, page_content) in pages_content.into_iter().enumerate() {
let Some(page_bounds) = page_content.bounds() else {
continue;
};
cairo_cx.save()?;
cairo_cx.translate(-page_bounds.mins[0], -page_bounds.mins[1]);
page_content.draw_to_cairo(
&cairo_cx,
doc_export_prefs.with_background,
doc_export_prefs.with_pattern,
doc_export_prefs.optimize_printing,
DocExportPrefs::MARGIN,
Engine::STROKE_EXPORT_IMAGE_SCALE,
)?;
cairo_cx.show_page().map_err(|e| {
anyhow::anyhow!(
"Showing page failed while exporting page {i} as pdf, Err: {e:?}"
)
})?;
cairo_cx.restore()?;
}
}
let data = *target_surface
.finish_output_stream()
.map_err(|e| anyhow::anyhow!("Finishing outputstream failed, Err: {e:?}"))?
.downcast::<Vec<u8>>()
.map_err(|e| {
anyhow::anyhow!("Downcasting finished output stream failed, Err: {e:?}")
})?;
Ok(data)
};
if oneshot_sender.send(result()).is_err() {View on GitHub (pinned to bbc5354502)