quarkusio/quarkus · error · RuntimeException
Failed to add repository ${modelRepo}
Error message
Failed to add repository ${modelRepo} What it means
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.
Source
Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DefaultEffectiveModelResolver.java:141
Repository modelRepo = null;
for (Repository r : rawModel.getRepositories()) {
if (r.getId().equals(parentResult.getRepository().getId())) {
modelRepo = r;
break;
}
}
if (modelRepo == null) {
modelRepo = new Repository();
modelRepo.setId(parentResult.getRepository().getId());
modelRepo.setLayout("default");
modelRepo.setReleases(new RepositoryPolicy());
}
modelRepo.setUrl(repoUrl);
try {
modelResolver.addRepository(modelRepo, false);
} catch (Exception e) {
throw new RuntimeException("Failed to add repository " + modelRepo, e);
}
}
}
final ModelBuildingRequest req = new DefaultModelBuildingRequest();
req.setPomFile(pomFile);
req.setRawModel(rawModel);
req.setModelResolver(modelResolver);
req.setSystemProperties(System.getProperties());
req.setUserProperties(System.getProperties());
req.setModelCache(modelCache);
try {
return modelBuilder.build(req).getEffectiveModel();
} catch (ModelBuildingException e) {
throw new RuntimeException("Failed to resolve the effective model of " + coords.toCompactCoords(), e);
}
}View on GitHub (pinned to e1c734241f)
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
Example fix
// before (pom) <repository><id>my repo!</id><url>repo.acme.com/maven2</url></repository> // after <repository><id>acme</id><url>https://repo.acme.com/maven2</url></repository>
Defensive patterns
Strategy: validation
Validate before calling
static boolean validRepoUrl(String url) {
try { new java.net.URI(url); return url.startsWith("https://") || url.startsWith("http://") || url.startsWith("file://"); }
catch (Exception e) { return false; }
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: POMs declaring repositories with bad or unreachable URLs, invalid characters in repository ids, repositories requiring authentication that the resolver session can't satisfy.
Related errors
- Unsupported format: ${format}
- Either the `extension` or `extensions` parameter must be set
- Cannot specify both class and method name
- The project artifact's extension is '${extension}' while thi
- Specifying a stream requires the Quarkus extension registry
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/4924b96c7a7ef50d.
Report an issue: GitHub.