{"record":{"id":"ab22e4291b5ea956","repo":"apache/maven","slug":"unable-to-build-project","errorCode":null,"errorMessage":"Unable to build project","messagePattern":"Unable to build project","errorType":"exception","errorClass":"ProjectBuilderException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java","lineNumber":196,"sourceCode":"                        }\n\n                        @Override\n                        public Severity getSeverity() {\n                            return Severity.valueOf(problem.getSeverity().name());\n                        }\n                    };\n                }\n\n                @Nonnull\n                @Override\n                public Optional<DependencyResolverResult> getDependencyResolverResult() {\n                    return Optional.ofNullable(res.getDependencyResolutionResult())\n                            .map(r -> new DefaultDependencyResolverResult(\n                                    null, r.getCollectionErrors(), session.getNode(r.getDependencyGraph()), 0));\n                }\n            };\n        } catch (ProjectBuildingException e) {\n            throw new ProjectBuilderException(\"Unable to build project\", e);\n        } finally {\n            RequestTraceHelper.exit(trace);\n        }\n    }\n\n    private static class SourceWrapper implements ModelSource2 {\n        private final Source source;\n\n        SourceWrapper(Source source) {\n            this.source = source;\n        }\n\n        @Override\n        public InputStream getInputStream() throws IOException {\n            return source.openStream();\n        }\n\n        @Override","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java#L178-L214","documentation":"ProjectBuilderException with message 'Unable to build project' wraps any ProjectBuildingException raised by the underlying legacy project builder while reading or making a POM effective. The DefaultProjectBuilder (Maven API service) delegates to the old builder and rethrows with this generic message; the real diagnostics (bad XML, unresolvable parent, invalid coordinates, model problems) are always in the cause chain.","triggerScenarios":"Session.getService(ProjectBuilder.class).build(request) where the target POM is malformed, its parent cannot be resolved from the repositories in the request/session, or model validation rejects the effective model.","commonSituations":"Broken pom.xml committed to the repo; parent POM published to a repository not included in the request's repository list; embedder/API code building poms without the repositories needed to resolve parents; syntactically invalid XML.","solutions":["Unwrap the cause: ProjectBuilderException.getCause() is a ProjectBuildingException whose results carry ModelProblems with file/line details","Fix the reported POM issues (XML syntax, parent coordinates, version format)","Ensure the request/session carries the remote repositories that host the unresolvable parent"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Cheap pre-checks before building via the API\nif (request.getPath().isPresent() && !Files.isReadable(request.getPath().get())) {\n    throw new IllegalArgumentException(\"POM not readable: \" + request.getPath().get());\n}","typeGuard":null,"tryCatchPattern":"try {\n    ProjectBuilderResult result = pb.build(request);\n} catch (ProjectBuilderException e) {\n    ProjectBuildingException pbe = (ProjectBuildingException) e.getCause();\n    for (ProjectBuildingResult r : pbe.getResults()) {\n        r.getProblems().forEach(p ->\n            log.error(\"{}:{}:{} {}\", p.getSource(), p.getLineNumber(), p.getColumnNumber(), p.getMessage()));\n    }\n}","preventionTips":["Feed the builder requests whose repository list covers all parents","Validate POM XML (well-formedness) before API builds in tooling","Report ModelProblems from the cause chain rather than the generic wrapper message"],"tags":["maven","pom","project-builder","model-building","maven-api"],"backgroundTag":"pom-model-building-failed","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}