{"record":{"id":"6e5fba2c8779f649","repo":"quarkusio/quarkus","slug":"failed-to-read-pom","errorCode":null,"errorMessage":"Failed to read ${pom}","messagePattern":"Failed to read (.+?)","errorType":"exception","errorClass":"BootstrapMavenException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java","lineNumber":154,"sourceCode":"                    module.getResolvedGroupId(),\n                    module.getResolvedVersion(),\n                    module.getModel(),\n                    module.effectiveModel,\n                    workspace);\n            if (currentProject == null && project.getDir().equals(currentProjectDir)) {\n                currentProject = project;\n            }\n        }\n        return currentProject;\n    }\n\n    static Model readModel(Path pom) throws BootstrapMavenException {\n        try {\n            final Model model = ModelUtils.readModel(pom);\n            model.setPomFile(pom.toFile());\n            return model;\n        } catch (IOException e) {\n            throw new BootstrapMavenException(\"Failed to read \" + pom, e);\n        }\n    }\n\n    static Path locateCurrentProjectPom(Path path, boolean required) throws BootstrapMavenException {\n        Path p = path;\n        while (p != null) {\n            final Path pom = p.resolve(POM_XML);\n            if (Files.exists(pom)) {\n                return pom;\n            }\n            p = p.getParent();\n        }\n        if (required) {\n            throw new BootstrapMavenException(\"Failed to locate project pom.xml for \" + path);\n        }\n        return null;\n    }\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java#L136-L172","documentation":"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>'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the pom path from the message exists and is a regular readable file: ls -l <pom>","Fix the working directory / project root configuration so locateCurrentProjectPom finds the real pom.xml","Restore a deleted or uncommitted pom.xml (git checkout / regenerate via quarkus create)","Fix filesystem permissions (chmod/chown) or run the build as a user with read access to the project","If the cause indicates malformed XML, repair the pom contents (run mvn validate with plain Maven to confirm)"],"exampleFix":"// before\nLocalProject.load(Path.of(\"/work/app\")); // no pom.xml in /work/app\n// after\nLocalProject.load(Path.of(\"/work/app\")); // ensure /work/app/pom.xml exists\n// e.g. restore it:\n// git -C /work/app checkout -- pom.xml","handlingStrategy":"validation","validationCode":"Path pom = projectDir.resolve(\"pom.xml\");\nif (!Files.isRegularFile(pom) || !Files.isReadable(pom)) {\n    throw new IllegalStateException(\"pom.xml missing or unreadable at \" + pom);\n}","typeGuard":null,"tryCatchPattern":"try {\n    LocalProject project = LocalProject.load(projectDir);\n} catch (BootstrapMavenException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to read \")) {\n        throw new IllegalStateException(\"Check the pom path/permissions: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Verify the directory you point the resolver at actually contains pom.xml","Commit poms to version control; don't rely on generated poms that `git clean` removes","Check file permissions when building inside containers or as different users","Run `mvn validate` to catch malformed/truncated pom files early"],"tags":["maven","pom","io","file-not-found"],"backgroundTag":"pom-read-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}