flxzt/rnote · error
Failed to parse `filename` attribute in XoppBackground with…
Error message
Failed to parse `filename` attribute in XoppBackground with node id {:?}, could not find attribute What it means
A pixmap XoppBackground must carry a 'filename' attribute pointing to the embedded/background image. When it is missing, load_from_xml returns this error and the pixmap background cannot be constructed.
Solutions
- Add filename="..." referencing the background image (for domain="absolute" the path must be resolvable)
- Re-save the file in Xournal++ with the image background intact
- Ensure the referenced image file exists at the expected location
- When generating xopp XML, always emit domain + filename together for pixmap backgrounds
Example fix
// before <background type="pixmap" domain="absolute"/> // after <background type="pixmap" domain="absolute" filename="bg.png"/>
Defensive patterns
Strategy: validation
Validate before calling
fn pixmap_bg_resolvable(node: &roxmltree::Node) -> bool {
node.attribute("filename")
.map(|f| std::path::Path::new(f).exists())
.unwrap_or(false)
} Try / catch
let filename = match node.attribute("filename") {
Some(f) => f.to_string(),
None => bail!("pixmap background missing filename"),
}; Prevention
- Always pair type="pixmap" with domain and filename
- Verify the referenced image exists (absolute domain) before load
- Keep image assets bundled when round-tripping xopp archives
When it happens
Trigger: load_from_xml on a <background type="pixmap"> node with valid domain but no 'filename' attribute.
Common situations: Files where the background element was hand-edited or partially regenerated; tools that emit pixmap backgrounds without the image reference; lost attributes during XML round-tripping.
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 width attribute of XoppPage for node with id
- failed to parse height attribute of XoppPage with node id
- failed to parse `type` attribute of XoppBackground with…
- Failed to parse `domain` attribute in XoppBackground with…
- Err while parsing `style` attribute of XoppBackground
AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08).
Data as JSON: /api/errors/6d06a1a65c3aaec2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-engine/src/fileformats/xoppformat.rs:404
})?,
)?;
self.bg_type = XoppBackgroundType::Solid { color, style };
}
"pixmap" => {
let domain = match node.attribute("domain").ok_or_else(|| {
anyhow::anyhow!("Failed to parse `domain` attribute in XoppBackground with node id {:?}, could not find attribute", node.id())
})? {
"absolute" => XoppBackgroundPixmapDomain::Absolute,
"attach" => XoppBackgroundPixmapDomain::Attach,
"clone" => XoppBackgroundPixmapDomain::Clone,
_ => {
return Err(anyhow::anyhow!("Err while parsing `style` attribute of XoppBackground with node id {:?}, is not a valid value", node.id()));
}
};
let filename = node
.attribute("filename")
.ok_or_else(|| {
anyhow::anyhow!("Failed to parse `filename` attribute in XoppBackground with node id {:?}, could not find attribute", node.id())
})?
.to_string();
self.bg_type = XoppBackgroundType::Pixmap { domain, filename };
}
"pdf" => {
self.bg_type = XoppBackgroundType::Pdf;
}
_ => {
return Err(anyhow::anyhow!("Failed to parse `type` attribute of XoppBackground with node id {:?}, is not a valid value", node.id()));
}
}
Ok(())
}
}
impl XmlWritable for XoppBackground {
fn write_to_xml(&self, w: &mut xmlwriter::XmlWriter) {View on GitHub (pinned to bbc5354502)