tonhowtf/omniget · error

conteúdo

Error message

conteúdo: {}

What it means

In rasterize_page (pdf_redact.rs), encoding the new page content stream (the Q/Do image-drawing operators) with Content::encode failed and is wrapped as 'conteúdo: {}'. The redaction replaces the page with a rasterized image, and that content stream could not be serialized.

Solutions

  1. Inspect the wrapped lopdf error for the failing operand
  2. Update lopdf to the latest release
  3. Log the ops list when encode fails to identify the malformed operation
Defensive patterns

Strategy: try-catch

Try / catch

let data = Content { operations: ops }.encode();
if let Err(e) = data { anyhow::bail!("rasterize content encode failed: {}", e); }

Prevention

When it happens

Trigger: Calling run() -> rasterize_page where the constructed Operation list for the rasterized page fails lopdf's Content::encode, e.g. invalid operator operands.

Common situations: Edge-case page content or image parameters producing operations lopdf cannot encode; lopdf version bugs in encode.

Understand the failure class

Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/c6624f8713974876. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/pdf_redact.rs:644

            Operation::new("q", vec![]),
            Operation::new(
                "cm",
                vec![
                    Object::Real(w),
                    Object::Real(0.0),
                    Object::Real(0.0),
                    Object::Real(h),
                    Object::Real(media[0]),
                    Object::Real(media[1]),
                ],
            ),
            Operation::new("Do", vec!["OGRXimg".into()]),
            Operation::new("Q", vec![]),
        ],
    };
    let stream_id = doc.add_object(Stream::new(
        dictionary! {},
        content.encode().map_err(|e| anyhow!("conteúdo: {}", e))?,
    ));
    let res_id = doc.add_object(Object::Dictionary(dictionary! {
        "XObject" => dictionary! { "OGRXimg" => Object::Reference(img_id) },
    }));
    let page = doc
        .get_dictionary_mut(page_id)
        .map_err(|e| anyhow!("página: {}", e))?;
    page.set("Contents", Object::Reference(stream_id));
    page.set("Resources", Object::Reference(res_id));
    page.remove(b"Annots");
    Ok(())
}

/// Tira as anotações que encostam na região: um campo de formulário ou uma
/// nota grudada ali carrega o texto de novo.
fn drop_annots(doc: &mut Document, page_id: lopdf::ObjectId, rects: &[Rect]) {
    let annots = match doc.get_dictionary(page_id).and_then(|p| p.get(b"Annots")) {
        Ok(Object::Array(a)) => a.clone(),

View on GitHub (pinned to 8600b91f42)