{"record":{"id":"7ff8be409932c634","repo":"quarkusio/quarkus","slug":"unable-to-parse-pom-file-pom","errorCode":null,"errorMessage":"Unable to parse pom file: ${pom}","messagePattern":"Unable to parse pom file: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/processor/src/main/java/io/quarkus/annotation/processor/util/ExtensionUtil.java","lineNumber":64,"sourceCode":"     * One option would be to pass it through the annotation processor but it's not exactly ideal.\n     */\n    public ExtensionModule getExtensionModule() {\n        Optional<Path> pom = filerUtil.getPomPath();\n\n        if (pom.isEmpty()) {\n            return ExtensionModule.createNotDetected();\n        }\n\n        Document doc;\n\n        try {\n            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);\n            DocumentBuilder db = dbf.newDocumentBuilder();\n            doc = db.parse(pom.get().toFile());\n            doc.getDocumentElement().normalize();\n        } catch (Exception e) {\n            throw new IllegalStateException(\"Unable to parse pom file: \" + pom, e);\n        }\n\n        return getExtensionModuleFromPom(pom.get(), doc);\n    }\n\n    private ExtensionModule getExtensionModuleFromPom(Path pom, Document doc) {\n        String parentGroupId = null;\n        String artifactId = null;\n        String groupId = null;\n        String name = null;\n        String guideUrl = null;\n\n        NodeList children = doc.getDocumentElement().getChildNodes();\n        for (int i = 0; i < children.getLength(); i++) {\n            if (groupId != null && artifactId != null && name != null) {\n                break;\n            }\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/processor/src/main/java/io/quarkus/annotation/processor/util/ExtensionUtil.java#L46-L82","documentation":"The annotation processor discovers extension metadata by parsing the module's pom.xml with a DOM document builder. If parsing fails for any reason (malformed XML, file unreadable, IO error), it wraps the exception in this IllegalStateException. Without a parseable pom, the processor cannot derive the ExtensionModule (name, module type, artifact info) needed for config documentation.","triggerScenarios":"getExtensionModel is called and db.parse(pom) throws: the pom.xml at the resolved path is malformed XML, truncated, locked, or the underlying file cannot be read at annotation-processing time.","commonSituations":"A half-written or syntactically invalid pom (unclosed tag, wrong encoding); a build running in a workspace where the pom was edited mid-build; file permission issues or a stale/corrupt checkout.","solutions":["Open the pom.xml reported in the message and validate its XML (e.g. mvn -q validate or an XML linter); fix syntax errors.","Restore the pom from version control if it was corrupted: git checkout -- pom.xml.","Check file permissions/readability of the pom for the user running the build.","Clean and rebuild the module to rule out a stale processing environment."],"exampleFix":"<!-- before: malformed -->\n<project>\n  <artifactId>quarkus-foo\n</project>\n<!-- after: well-formed -->\n<project>\n  <artifactId>quarkus-foo</artifactId>\n</project>","handlingStrategy":"validation","validationCode":"try {\n    DocumentBuilderFactory.newInstance().newDocumentBuilder()\n        .parse(new File(\"pom.xml\"));\n} catch (Exception e) {\n    throw new IllegalStateException(\"pom.xml is not valid XML: \" + e.getMessage(), e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    build();\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unable to parse pom file\")) {\n        restorePomFromVcs();\n    } else throw e;\n}","preventionTips":["Validate pom.xml after hand-editing it (mvn validate).","Avoid editing poms while a build is running in the same workspace.","Commit poms with correct encoding and never truncate file writes.","Use git diff/status to detect accidental pom corruption before building."],"tags":["quarkus","annotation-processor","maven","pom","xml-parsing"],"backgroundTag":"pom-parse-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}