{"record":{"id":"32a1625d7874a44e","repo":"flxzt/rnote","slug":"failed-to-parse-y-attribute-in-xopptext-with-nod","errorCode":null,"errorMessage":"failed to parse `y` attribute in XoppText with node id {:?}, could not find attribute","messagePattern":"failed to parse `y` attribute in XoppText with node id (.+?), could not find attribute","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-engine/src/fileformats/xoppformat.rs","lineNumber":897,"sourceCode":"                    node.id()\n                )\n            })?\n            .parse::<f64>()?;\n\n        self.x = node\n            .attribute(\"x\")\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"failed to parse `x` attribute in XoppText with node id {:?}, could not find attribute\",\n                    node.id()\n                )\n            })?\n            .parse::<f64>()?;\n\n        self.y = node\n            .attribute(\"y\")\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"failed to parse `y` attribute in XoppText with node id {:?}, could not find attribute\",\n                    node.id()\n                )\n            })?\n            .parse::<f64>()?;\n\n        self.color =\n            XoppColor::from_strokecolor_attr_value(node.attribute(\"color\").ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"failed to parse `color` attribute in XoppText with node id {:?}, could not find attribute\",\n                    node.id()\n                )\n            })?)?;\n\n        if let Some(text) = node.text() {\n            self.text = text.to_string();\n        }\n","sourceCodeStart":879,"sourceCodeEnd":915,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-engine/src/fileformats/xoppformat.rs#L879-L915","documentation":"Thrown by XoppText::load_from_xml when a `<text>` element has no `y` attribute. The y coordinate (f64) is required to place the text; its absence aborts parsing with this anyhow error including the XML node id.","triggerScenarios":"Importing a .xopp file whose <text> element lacks the `y` attribute, e.g. produced by scripts or manual edits that dropped coordinate attributes.","commonSituations":"Custom exporters omitting y; hand-edited XML; damaged or truncated files.","solutions":["Add a y attribute to the <text> element, e.g. y=\"50.0\".","Regenerate the file with all required text attributes present.","Open in Xournal++, re-save, and re-import the repaired file."],"exampleFix":"// before (file XML)\n<text font=\"Sans\" size=\"12\" x=\"100\">Hello</text>\n// after (file XML)\n<text font=\"Sans\" size=\"12\" x=\"100\" y=\"50\">Hello</text>","handlingStrategy":"validation","validationCode":"fn text_has_y(xml: &str) -> Result<(), String> {\n    for (i, chunk) in xml.split(\"<text\").skip(1).enumerate() {\n        let head = chunk.split('>').next().unwrap_or(\"\");\n        if !head.contains(\"y=\") {\n            return Err(format!(\"text #{i} missing `y` attribute\"));\n        }\n    }\n    Ok(())\n}","typeGuard":"fn has_numeric_attr(attrs: &[(&str, &str)], name: &str) -> bool {\n    attrs.iter().any(|(k, v)| *k == name && v.parse::<f64>().is_ok())\n}","tryCatchPattern":"match import_xopp(path) {\n    Err(e) if e.to_string().contains(\"`y` attribute in XoppText\") => {\n        eprintln!(\"Text element missing y coordinate; add it or re-save in Xournal++: {e:#}\");\n    }\n    Err(e) => eprintln!(\"import failed: {e:#}\"),\n    Ok(doc) => { /* proceed */ }\n}","preventionTips":["Emit both x and y for every text element; never write only one coordinate","Pre-validate required numeric attributes before import","Round-trip generated files through Xournal++ to catch omissions"],"tags":["parsing","xml","missing-attribute","xopp"],"backgroundTag":"missing-required-argument","analyzedSha":"bbc5354502ba2fc83eec2670b535348825e679a6","analyzedAt":"2026-09-08T13:20:33.747Z","contentChangedAt":"2026-09-08T13:20:33.747Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}