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

  1. Validate the pom.xml is well-formed (mvn help:effective-pom or an XML validator)
  2. Restore the pom from version control (git checkout -- pom.xml)
  3. Check file read permissions on the pom
  4. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/9be16381d8ec3264. Report an issue: GitHub.