{"record":{"id":"1e14c9924ab1c9b1","repo":"quarkusio/quarkus","slug":"failed-to-build-model-for-groupid-artifactid","errorCode":null,"errorMessage":"Failed to build model for ${groupId}:${artifactId}:${version}","messagePattern":"Failed to build model for (.+?):(.+?):(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java","lineNumber":118,"sourceCode":"\n    private void completeWorkspaceProjectBuildRequest(ModelBuildingRequest request) {\n        final Set<String> addedProfiles;\n        final List<Profile> profiles = request.getProfiles();\n        if (profiles.isEmpty()) {\n            addedProfiles = Set.of();\n        } else {\n            addedProfiles = new HashSet<>(profiles.size());\n            for (Profile p : profiles) {\n                addedProfiles.add(p.getId());\n            }\n        }\n\n        final List<Profile> activeSettingsProfiles;\n        try {\n            activeSettingsProfiles = ctx.getActiveSettingsProfiles();\n        } catch (BootstrapMavenException e) {\n            var requestModel = request.getRawModel();\n            throw new RuntimeException(\"Failed to build model for \" + ModelUtils.getGroupId(requestModel)\n                    + \":\" + requestModel.getArtifactId() + \":\" + ModelUtils.getVersion(requestModel), e);\n        }\n\n        for (Profile p : activeSettingsProfiles) {\n            if (!addedProfiles.contains(p.getId())) {\n                profiles.add(p);\n                request.getActiveProfileIds().add(p.getId());\n            }\n        }\n\n        final BootstrapMavenOptions cliOptions = ctx.getCliOptions();\n        request.getActiveProfileIds().addAll(cliOptions.getActiveProfileIds());\n        request.getInactiveProfileIds().addAll(cliOptions.getInactiveProfileIds());\n        request.setUserProperties(System.getProperties());\n    }\n\n    @Override\n    public ModelBuildingResult build(ModelBuildingRequest request, ModelBuildingResult result) throws ModelBuildingException {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java#L100-L136","documentation":"MavenModelBuilder completes a workspace project model build and needs the active profiles from the Maven settings (ctx.getActiveSettingsProfiles()). If reading/activating those settings profiles fails, it throws a RuntimeException naming the groupId:artifactId:version of the raw model it was building. The real reason is in the wrapped BootstrapMavenException cause.","triggerScenarios":"Calling the model builder (via build()/completeWorkspaceProjectBuildRequest) for a project while the user's settings.xml cannot be read, is malformed XML, or profile activation in it throws - i.e. any BootstrapMavenException from ctx.getActiveSettingsProfiles().","commonSituations":"Invalid ~/.m2/settings.xml (syntax error, wrong namespace), a settings profile referencing a missing file or repo, stale settings after a Maven upgrade, a corrupted local settings cache, or a project version derived from an unresolvable parent.","solutions":["Validate ~/.m2/settings.xml (and -s/-gs alternates) parses as XML and follows the Maven settings schema","Read the wrapped BootstrapMavenException cause for the exact settings/profile problem and fix that (bad profile id, missing file, invalid activation)","Temporarily move settings.xml aside to confirm it is the trigger, then re-add profiles one by one","Check the GAV printed in the message: confirm the pom's groupId/artifactId/version (or inherited parent version) is resolvable"],"exampleFix":"// before: broken settings.xml\n<settings><profiles><profile><id>dev</id><repositories><repository><url>file:/missing/repo</url></repository></repositories></profile></profiles></settings>\n// after: remove or fix the invalid profile entry, then validate with\nmvn help:effective-settings","handlingStrategy":"validation","validationCode":"// Validate settings.xml parses before building models\nPath settings = Path.of(System.getProperty(\"user.home\"), \".m2\", \"settings.xml\");\nif (Files.exists(settings)) {\n    try (InputStream in = Files.newInputStream(settings)) {\n        DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);\n    } catch (Exception e) {\n        throw new IllegalStateException(\"Invalid settings.xml: \" + settings, e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Model model = modelBuilder.build(request);\n} catch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    log.error(\"Model build failed for project; root cause: \" + (cause != null ? cause.getMessage() : e.getMessage()));\n    throw e;\n}","preventionTips":["Validate settings.xml with `mvn help:effective-settings` after editing it","Keep settings profiles minimal and confirm each profile's activation condition is valid","Check poms into git so generated/deleted poms do not break workspace discovery","Pin a consistent Maven version used by both the CLI and the resolver"],"tags":["maven","pom","settings-xml","model-building"],"backgroundTag":"maven-model-build-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}