flxzt/rnote · error
failed to parse `right` attribute in XoppText with node id
Error message
failed to parse `right` attribute in XoppText with node id {:?}, could not find attribute What it means
Thrown when a `<text>` element in a .xopp file has no `right` attribute during XoppText parsing. The parser needs all four bounds (top/left/right/bottom) to reconstruct the text's rectangle; missing `right` means the document is malformed.
Solutions
- Re-save the file with Xournal++ to regenerate complete bounds attributes.
- Add `right="..."` to the `<text>` node with the id shown in the error.
- Fix the external generator to emit top/left/right/bottom on every text element.
- Validate the xopp XML against expected text-element attributes before importing.
Example fix
// before <text left="50.0" top="100.0">...</text> // after <text left="50.0" top="100.0" right="200.0" bottom="150.0">...</text>
Defensive patterns
Strategy: validation
Validate before calling
// rust
fn text_node_has_bounds(node: &roxmltree::Node) -> bool {
["top", "left", "right", "bottom"].iter().all(|a| node.attribute(a).is_some())
} Type guard
fn get_f64_attr(node: &roxmltree::Node, name: &str) -> Option<f64> {
node.attribute(name).and_then(|v| v.parse::<f64>().ok())
} Try / catch
match xopp_file.parse() {
Ok(doc) => doc,
Err(e) if e.to_string().contains("`right`") => {
eprintln!(".xopp text node missing 'right' attribute: {e}");
}
} Prevention
- Emit complete bounds in any tool that writes .xopp files.
- Validate xopp XML before loading.
- Prefer round-tripping through Xournal++ over manual edits.
When it happens
Trigger: Loading a .xopp file whose `<text>` node lacks a `right` XML attribute via the xopp format importer.
Common situations: Files generated by custom scripts that only write x/y position; hand-edited documents; older or incompatible Xournal++ file variants.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- failed to parse `top` attribute in XoppText with node id
- failed to parse `bottom` attribute in XoppText with node id
- Failed to parse `type` attribute of XoppBackground with…
- failed to parse `tool` attribute in XoppStroke with node id
- failed to parse `color` attribute in XoppStroke with node id
AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08).
Data as JSON: /api/errors/d00bdb9228bf4fdb.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-engine/src/fileformats/xoppformat.rs:979
})?
.parse::<f64>()?;
// Top
self.top = node
.attribute("top")
.ok_or_else(|| {
anyhow::anyhow!(
"failed to parse `top` attribute in XoppText with node id {:?}, could not find attribute",
node.id()
)
})?
.parse::<f64>()?;
// Right
self.right = node
.attribute("right")
.ok_or_else(|| {
anyhow::anyhow!(
"failed to parse `right` attribute in XoppText with node id {:?}, could not find attribute",
node.id()
)
})?
.parse::<f64>()?;
// Bottom
self.bottom = node
.attribute("bottom")
.ok_or_else(|| {
anyhow::anyhow!(
"failed to parse `bottom` attribute in XoppText with node id {:?}, could not find attribute",
node.id()
)
})?
.parse::<f64>()?;
// DataView on GitHub (pinned to bbc5354502)