quarkusio/quarkus · error · QuarkusCommandException
Error while reading pom: ${pom}
Error message
Error while reading pom: ${pom} What it means
readPom wraps IOException from MojoUtils.readPom into QuarkusCommandException('Error while reading pom: <pom path>'). The pom exists (checkPomExists passed) but cannot be parsed/read, e.g. malformed XML or unreadable file.
Source
Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateExtensionCommandHandler.java:141
final Path extensionsPom = checkPomExists(extensionsDir);
new PomTransformer(extensionsPom, StandardCharsets.UTF_8)
.transform(PomTransformer.Transformation.addModule(extensionDirName));
}
public static Path checkPomExists(Path dir) throws QuarkusCommandException {
final Path pom = dir.resolve("pom.xml");
if (!Files.exists(pom)) {
throw new QuarkusCommandException("Invalid directory structure, file not found: " + pom.toString());
}
return pom;
}
public static Model readPom(Path dir) throws QuarkusCommandException {
final Path pom = checkPomExists(dir);
try {
return MojoUtils.readPom(pom.toFile());
} catch (IOException e) {
throw new QuarkusCommandException("Error while reading pom: " + pom.toString(), e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Validate the pom.xml is well-formed (mvn help:effective-pom or an XML validator)
- Restore the pom from version control (git checkout -- pom.xml)
- Check file read permissions on the pom
- Look at the cause exception for the precise parse error and line
Defensive patterns
Strategy: validation
Validate before calling
Path pom = dir.resolve("pom.xml");
if (!Files.isReadable(pom)) throw new IllegalStateException("pom not readable: " + pom);
try { new javax.xml.parsers.DocumentBuilderFactory().newDocumentBuilder().parse(pom.toFile()); }
catch (Exception e) { throw new IllegalStateException("pom is not well-formed XML: " + pom, e); } Try / catch
try { Model m = CreateExtensionCommandHandler.readPom(dir); } catch (QuarkusCommandException e) { /* e.getCause() has the parse detail */ } Prevention
- Never hand-edit poms with non-XML-safe tools
- Keep poms clean in git; revert local corruption
- Check file permissions on shared filesystems
- Run mvn validate before scaffolding commands
When it happens
Trigger: Calling readPom(dir) when the pom.xml is unreadable (permissions) or MojoUtils' Maven model builder fails with IOException.
Common situations: Corrupt or hand-edited pom.xml with invalid XML; file locked by another process; restrictive file permissions after checkout on shared filesystems.
Related errors
- Unable to parse pom file: ${pom}
- Could not resolve POM for
- Unable to update the pom.xml file
- The parent project must have a packaging type of POM. Curren
- Unable to update the pom.xml file
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/9be16381d8ec3264.
Report an issue: GitHub.