{"record":{"id":"59c0b818487109b6","repo":"quarkusio/quarkus","slug":"failed-to-initialize-model-resolver","errorCode":null,"errorMessage":"Failed to initialize model resolver","messagePattern":"Failed to initialize model resolver","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DefaultEffectiveModelResolver.java","lineNumber":91,"sourceCode":"            pomResult = resolver.resolve(new DefaultArtifact(coords.getGroupId(), coords.getArtifactId(),\n                    coords.getClassifier(), coords.getType(), coords.getVersion()), repos);\n            pomFile = pomResult.getArtifact().getFile();\n        } catch (BootstrapMavenException e) {\n            throw new RuntimeException(\"Failed to resolve \" + coords.toCompactCoords(), e);\n        }\n\n        final Model rawModel;\n        try {\n            rawModel = ModelUtils.readModel(pomFile.toPath());\n        } catch (IOException e1) {\n            throw new RuntimeException(\"Failed to read \" + pomFile, e1);\n        }\n\n        final ModelResolver modelResolver;\n        try {\n            modelResolver = BootstrapModelResolver.newInstance(resolver.getMavenContext(), null);\n        } catch (BootstrapMavenException e) {\n            throw new RuntimeException(\"Failed to initialize model resolver\", e);\n        }\n\n        // override the relative path to the parent in case it's in the local Maven repo\n        Parent parent = rawModel.getParent();\n        if (parent != null) {\n            final Artifact parentPom = new DefaultArtifact(parent.getGroupId(), parent.getArtifactId(),\n                    ArtifactCoords.TYPE_POM, parent.getVersion());\n            final ArtifactResult parentResult;\n            final Path parentPomPath;\n            try {\n                parentResult = resolver.resolve(parentPom, repos);\n                parentPomPath = parentResult.getArtifact().getFile().toPath();\n            } catch (BootstrapMavenException e) {\n                throw new RuntimeException(\"Failed to resolve \" + parentPom, e);\n            }\n            try {\n                rawModel.getParent()\n                        .setRelativePath(pomFile.toPath().getParent().relativize(parentPomPath).toString());","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DefaultEffectiveModelResolver.java#L73-L109","documentation":"Thrown when BootstrapModelResolver.newInstance(mavenContext, null) fails with BootstrapMavenException while creating the model resolver used to resolve parent POMs and imported BOMs during model building.","triggerScenarios":"resolveEffectiveModel(...) reaching the modelResolver setup when the MavenContext is invalid (bad session/settings/workspace reader configuration).","commonSituations":"Same root causes as resolver initialization failures: invalid settings.xml, broken Maven context built programmatically, classpath missing required resolver components.","solutions":["Validate the MavenContext/settings used to build the MavenArtifactResolver","Check that all resolver dependencies (maven-resolver, plexus-utils) are on the classpath at the expected versions","Inspect the BootstrapMavenException cause chain for the concrete misconfiguration","Recreate MavenArtifactResolver with default detection (let it discover settings.xml itself)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure context is functional before model building\nObjects.requireNonNull(resolver.getMavenContext(), \"MavenContext must be set\");\nObjects.requireNonNull(resolver.getMavenContext().getRepositorySystemSession(), \"RepositorySystemSession must be set\");","typeGuard":null,"tryCatchPattern":"try {\n    Model m = modelResolver.resolveEffectiveModel(coords);\n} catch (RuntimeException e) {\n    throw new IllegalStateException(\"Model resolver init failed: \" + e.getMessage(), e.getCause());\n}","preventionTips":["Build MavenArtifactResolver via its standard factory/builder","Keep bootstrap resolver dependencies on the classpath","Validate settings/session configuration early in application startup"],"tags":["maven","bootstrap","initialization"],"backgroundTag":"maven-resolver-init-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"}