{"record":{"id":"ace9837dddce34d1","repo":"quarkusio/quarkus","slug":"failed-to-parse-pom","errorCode":null,"errorMessage":"Failed to parse POM","messagePattern":"Failed to parse POM","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java","lineNumber":261,"sourceCode":"        }\n        final Properties props = new Properties();\n        try (BufferedReader reader = Files.newBufferedReader(propsPath)) {\n            props.load(reader);\n        }\n        return props;\n    }\n\n    public static Model readModel(final Path pomXml) throws IOException {\n        Model model = readModel(Files.newInputStream(pomXml));\n        model.setPomFile(pomXml.toFile());\n        return model;\n    }\n\n    public static Model readModel(InputStream stream) throws IOException {\n        try (InputStream is = stream) {\n            return new MavenXpp3Reader().read(is);\n        } catch (XmlPullParserException e) {\n            throw new IOException(\"Failed to parse POM\", e);\n        }\n    }\n\n    public static void persistModel(Path pomFile, Model model) throws IOException {\n        final MavenXpp3Writer xpp3Writer = new MavenXpp3Writer();\n        try (BufferedWriter pomFileWriter = Files.newBufferedWriter(pomFile)) {\n            xpp3Writer.write(pomFileWriter, model);\n        }\n    }\n}\n","sourceCodeStart":243,"sourceCodeEnd":272,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java#L243-L272","documentation":"ModelUtils.readModel(InputStream) parses a POM with MavenXpp3Reader. If the stream is not well-formed XML (XmlPullParserException), it is rethrown as IOException(\"Failed to parse POM\", e). It means the pom.xml content itself is malformed, not that the file is missing.","triggerScenarios":"Calling ModelUtils.readModel(Path) or readModel(InputStream) on a pom.xml containing XML syntax errors: unclosed tags, invalid characters/encoding, garbage bytes, truncated file, HTML instead of XML, or reading a non-XML file path by mistake.","commonSituations":"A merge conflict left conflict markers (<<<<<<<) in pom.xml; an interrupted build/write truncated the file; manual edits broke a tag; wrong file passed (e.g. a .txt or log file); encoding mismatches (BOM, non-UTF-8 bytes).","solutions":["Open the pom.xml at the reported path and fix the XML syntax; run `mvn validate` or `xmllint --noout pom.xml` to confirm it parses.","If merge conflict markers are present, resolve the merge and commit a clean pom.xml.","Restore a corrupted/truncated pom.xml (git checkout -- pom.xml or rebuild it).","Ensure the correct file path is being passed to readModel."],"exampleFix":"// before: conflicted pom.xml\n<<<<<<< HEAD\n  <version>1.0.0</version>\n=======\n  <version>2.0.0</version>\n>>>>>>> feature\n// after: resolved\n  <version>2.0.0</version>","handlingStrategy":"validation","validationCode":"static void validatePomXml(Path pom) throws IOException {\n    try {\n        new javax.xml.parsers.DocumentBuilderFactory().newInstance()\n            .newDocumentBuilder().parse(pom.toFile());\n    } catch (Exception e) {\n        throw new IOException(\"Malformed POM XML: \" + pom + \" - \" + e.getMessage(), e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Model model = ModelUtils.readModel(pomStream);\n} catch (IOException e) {\n    if (e.getCause() instanceof XmlPullParserException) {\n        throw new IllegalStateException(\"Fix XML syntax in the POM: \" + e.getCause().getMessage());\n    }\n    throw e;\n}","preventionTips":["Run `xmllint --noout pom.xml` or `mvn validate` after hand-editing a POM.","Resolve all merge conflicts in pom.xml before building.","Keep XML editors configured for UTF-8 without stray BOM issues.","Restore corrupted pom.xml files from version control rather than hand-fixing bytes."],"tags":["maven","pom","xml-parsing","quarkus-bootstrap"],"backgroundTag":"malformed-xml","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}