flxzt/rnote · error · anyhow::Error

`engine_snapshot` has no value `document`.

Error message

`engine_snapshot` has no value `document`.

What it means

Wrapper in export_doc_as_pdf_bytes: cairo_cx.show_page() returned an Err while emitting page i of the PDF, i.e. cairo failed to finalize that page onto the PDF target surface. Any cairo-level failure during PDF page output surfaces through this mapping.

Solutions

  1. Re-run the export; cairo surface-state errors can be transient.
  2. Verify the PDF target surface and output stream are valid and writable.
  3. Inspect the cairo error variant carried in `e` for the underlying cairo status.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:23 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/0694def0615515fc. Report an issue: GitHub.

Appendix: source

Thrown at crates/rnote-engine/src/fileformats/rnoteformat/maj0min13.rs:23

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RnoteFileMaj0Min13 {
    /// A snapshot of the engine.
    #[serde(rename = "engine_snapshot")]
    pub engine_snapshot: ijson::IValue,
}

impl TryFrom<RnoteFileMaj0Min9> for RnoteFileMaj0Min13 {
    type Error = anyhow::Error;

    fn try_from(mut value: RnoteFileMaj0Min9) -> Result<Self, Self::Error> {
        let engine_snapshot = value
            .engine_snapshot
            .as_object_mut()
            .ok_or_else(|| anyhow::anyhow!("engine snapshot is not a JSON object."))?;
        let document = engine_snapshot
            .get_mut("document")
            .ok_or_else(|| anyhow!("`engine_snapshot` has no value `document`."))?
            .as_object_mut()
            .ok_or_else(|| anyhow!("`document` is not a JSON object."))?;

        let format = document
            .remove("format")
            .ok_or_else(|| anyhow!("document has no value `format`."))?;
        let background = document
            .remove("background")
            .ok_or_else(|| anyhow!("document has no value `background`."))?;
        let layout = document
            .remove("layout")
            .ok_or_else(|| anyhow!("document has no value `layout`."))?;
        // discard `snap_positions`, this config is now global.
        document.remove("snap_positions");

        let mut document_config = ijson::IObject::new();
        document_config.insert("format", format);
        document_config.insert("background", background);

View on GitHub (pinned to bbc5354502)