{"record":{"id":"4924b96c7a7ef50d","repo":"quarkusio/quarkus","slug":"failed-to-add-repository-modelrepo","errorCode":null,"errorMessage":"Failed to add repository ${modelRepo}","messagePattern":"Failed to add repository (.+?)","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":141,"sourceCode":"                Repository modelRepo = null;\n                for (Repository r : rawModel.getRepositories()) {\n                    if (r.getId().equals(parentResult.getRepository().getId())) {\n                        modelRepo = r;\n                        break;\n                    }\n                }\n                if (modelRepo == null) {\n                    modelRepo = new Repository();\n                    modelRepo.setId(parentResult.getRepository().getId());\n                    modelRepo.setLayout(\"default\");\n                    modelRepo.setReleases(new RepositoryPolicy());\n                }\n                modelRepo.setUrl(repoUrl);\n\n                try {\n                    modelResolver.addRepository(modelRepo, false);\n                } catch (Exception e) {\n                    throw new RuntimeException(\"Failed to add repository \" + modelRepo, e);\n                }\n            }\n        }\n\n        final ModelBuildingRequest req = new DefaultModelBuildingRequest();\n        req.setPomFile(pomFile);\n        req.setRawModel(rawModel);\n        req.setModelResolver(modelResolver);\n        req.setSystemProperties(System.getProperties());\n        req.setUserProperties(System.getProperties());\n        req.setModelCache(modelCache);\n\n        try {\n            return modelBuilder.build(req).getEffectiveModel();\n        } catch (ModelBuildingException e) {\n            throw new RuntimeException(\"Failed to resolve the effective model of \" + coords.toCompactCoords(), e);\n        }\n    }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DefaultEffectiveModelResolver.java#L123-L159","documentation":"Thrown when modelResolver.addRepository(modelRepo, false) throws while registering a repository discovered from the model (pom <repositories> or Quarkus metadata) into the model resolver. The failing modelRepo object is included in the message.","triggerScenarios":"resolveEffectiveModel(...) iterating repositories derived from the POM/extension metadata and calling addRepository when the repository definition is invalid (malformed URL, duplicate id with incompatible settings, invalid policy).","commonSituations":"POMs declaring repositories with bad or unreachable URLs, invalid characters in repository ids, repositories requiring authentication that the resolver session can't satisfy.","solutions":["Fix the <repository> URL/id declared in the POM (must be a valid http(s)/file URL)","Remove duplicate repository ids conflicting with settings.xml repositories","Verify protocol support (e.g. no blocked http:// repos over https-only transports)","Pre-validate repository URLs in your build tooling before resolution"],"exampleFix":"// before (pom)\n<repository><id>my repo!</id><url>repo.acme.com/maven2</url></repository>\n// after\n<repository><id>acme</id><url>https://repo.acme.com/maven2</url></repository>","handlingStrategy":"validation","validationCode":"static boolean validRepoUrl(String url) {\n    try { new java.net.URI(url); return url.startsWith(\"https://\") || url.startsWith(\"http://\") || url.startsWith(\"file://\"); }\n    catch (Exception e) { return false; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use https URLs and simple alphanumeric ids for repositories in POMs","Avoid duplicate repository ids across POMs and settings.xml","Pre-validate model-declared repository URLs in CI"],"tags":["maven","repository","configuration"],"backgroundTag":"invalid-repository-url","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"}