quarkusio/quarkus · error · QuarkusCommandException

Error while reading base pom.xml

Error message

Error while reading base pom.xml

What it means

During extension creation, CreateExtension reads the base pom.xml via MojoUtils.readPom to build the Maven model. If that read fails with an IOException, it is wrapped in a QuarkusCommandException with this message, meaning the base POM exists but could not be parsed or opened.

Source

Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/CreateExtension.java:426

    }

    private String computeDefaultNamespaceName(String namespaceId) {
        if (isEmpty(namespaceId)) {
            return "";
        }
        return capitalize(namespaceId) + " - ";
    }

    public static Model resolveModel(Path dir) throws QuarkusCommandException {
        final Path workingDir = resolveWorkingDir(dir);
        final Path basePom = workingDir.resolve("pom.xml");
        if (!Files.isRegularFile(basePom)) {
            return null;
        }
        try {
            return MojoUtils.readPom(basePom.toFile());
        } catch (IOException e) {
            throw new QuarkusCommandException("Error while reading base pom.xml", e);
        }
    }

    private Model getStandaloneTempModel(Path workingDir, String runtimeArtifactId, String defaultVersion) {
        final Model model = new Model();
        model.setGroupId(data.getRequiredStringValue(GROUP_ID));
        model.setArtifactId(runtimeArtifactId + "-parent");
        model.setVersion(data.getStringValue(VERSION).orElse(defaultVersion));
        model.setPomFile(workingDir.resolve("pom.xml").toFile());
        return model;
    }

    private String getRuntimeArtifactIdFromData() {
        return data.getStringValue(NAMESPACE_ID).orElse("")
                + data.getRequiredStringValue(EXTENSION_ID);
    }

    private static Path resolveWorkingDir(Path dir) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Validate the base pom.xml is well-formed XML (e.g. mvn -f pom.xml validate)
  2. Check file read permissions on the base pom.xml
  3. Restore the base pom.xml from version control
  4. Run the command again in case of a transient/concurrent file issue

Example fix

// validate before running
mvn help:effective-pom -f /path/to/base/pom.xml // must succeed
// then re-run quarkus create-extension
Defensive patterns

Strategy: try-catch

Validate before calling

Path basePom = workingDir.resolve("pom.xml");
if (Files.isRegularFile(basePom)) { try { new String(Files.readAllBytes(basePom)); } catch (IOException e) { throw new IllegalStateException("unreadable pom", e); } }

Try / catch

try { command.execute(); } catch (QuarkusCommandException e) { if (e.getMessage().equals("Error while reading base pom.xml")) { log.error("Base pom.xml unreadable/invalid: fix or restore it", e.getCause()); } }

Prevention

When it happens

Trigger: Calling prepare/execute of CreateExtension when resolveModel (via baseModel) finds a regular file at the base pom path but MojoUtils.readPom throws IOException — unreadable file, malformed XML, or permission issues.

Common situations: Corrupted or hand-edited base pom.xml with invalid XML; file permission problems; encoding issues in the POM; the POM being modified concurrently while reading.

Related errors


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