quarkusio/quarkus · error · BootstrapMavenException

Failed to read ${pom}

Error message

Failed to read ${pom}

What it means

LocalProject.readModel(Path pom) reads a pom.xml via ModelUtils.readModel and records the pom path on the resulting Model. If reading the file raises IOException (missing file, unreadable, invalid path, or low-level I/O problem during parse), it wraps it in BootstrapMavenException 'Failed to read <pom>'.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java:154

                    module.getResolvedGroupId(),
                    module.getResolvedVersion(),
                    module.getModel(),
                    module.effectiveModel,
                    workspace);
            if (currentProject == null && project.getDir().equals(currentProjectDir)) {
                currentProject = project;
            }
        }
        return currentProject;
    }

    static Model readModel(Path pom) throws BootstrapMavenException {
        try {
            final Model model = ModelUtils.readModel(pom);
            model.setPomFile(pom.toFile());
            return model;
        } catch (IOException e) {
            throw new BootstrapMavenException("Failed to read " + pom, e);
        }
    }

    static Path locateCurrentProjectPom(Path path, boolean required) throws BootstrapMavenException {
        Path p = path;
        while (p != null) {
            final Path pom = p.resolve(POM_XML);
            if (Files.exists(pom)) {
                return pom;
            }
            p = p.getParent();
        }
        if (required) {
            throw new BootstrapMavenException("Failed to locate project pom.xml for " + path);
        }
        return null;
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify the pom path from the message exists and is a regular readable file: ls -l <pom>
  2. Fix the working directory / project root configuration so locateCurrentProjectPom finds the real pom.xml
  3. Restore a deleted or uncommitted pom.xml (git checkout / regenerate via quarkus create)
  4. Fix filesystem permissions (chmod/chown) or run the build as a user with read access to the project
  5. If the cause indicates malformed XML, repair the pom contents (run mvn validate with plain Maven to confirm)

Example fix

// before
LocalProject.load(Path.of("/work/app")); // no pom.xml in /work/app
// after
LocalProject.load(Path.of("/work/app")); // ensure /work/app/pom.xml exists
// e.g. restore it:
// git -C /work/app checkout -- pom.xml
Defensive patterns

Strategy: validation

Validate before calling

Path pom = projectDir.resolve("pom.xml");
if (!Files.isRegularFile(pom) || !Files.isReadable(pom)) {
    throw new IllegalStateException("pom.xml missing or unreadable at " + pom);
}

Try / catch

try {
    LocalProject project = LocalProject.load(projectDir);
} catch (BootstrapMavenException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Failed to read ")) {
        throw new IllegalStateException("Check the pom path/permissions: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling load()/readModel for a project whose pom.xml does not exist at the located path, the process lacks read permission, the path is a directory, or the file cannot be opened/parsed at the I/O level (e.g. truncated file, encoding/parse errors surfacing as IOException).

Common situations: Pointing Quarkus at a directory without a root pom.xml, deleting or renaming pom.xml while an application is being built, wrong quarkus.project.* config pointing at the wrong folder, git clean removing generated poms, or permission issues in containers.

Related errors


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