quarkusio/quarkus · error · RuntimeException

Failed to resolve the effective model of ${coords.toCompactC

Error message

Failed to resolve the effective model of ${coords.toCompactCoords()}

What it means

Thrown when the Maven model builder fails to produce the effective model for the given coordinates — the POM (and its parents) were fetched but model building itself failed. All accumulated ModelBuilding problems (syntax, inheritance, interpolation, plugin validation) are behind this error.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DefaultEffectiveModelResolver.java:157

                    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);
        }
    }

    static class BootstrapModelCache implements ModelCache {

        private final RepositorySystemSession session;

        private final RepositoryCache cache;

        BootstrapModelCache(RepositorySystemSession session) {
            this.session = session;
            this.cache = session.getCache() == null ? new DefaultRepositoryCache() : session.getCache();
        }

        @Override
        public Object get(String groupId, String artifactId, String version, String tag) {
            return cache.get(session, new Key(groupId, artifactId, version, tag));
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the cause chain (ModelBuildingException problems) — it names the exact POM line and problem
  2. Fix the invalid POM content at the reported location (XML syntax, missing properties, bad parent)
  3. Ensure all parents and imported BOMs of the POM are resolvable
  4. Validate the POM with 'mvn validate' or 'mvn help:effective-pom' locally before resolving programmatically

Example fix

// before
<version>${project.parent.version}-SNAPSHOT</version> // property typo breaks interpolation
// after
<version>1.0.0-SNAPSHOT</version>  // or fix the parent version reference
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate the POM with Maven before programmatic building
Process p = new ProcessBuilder("mvn", "-q", "validate", "-f", pomFile.toString()).inheritIO().start();
if (p.waitFor() != 0) throw new IllegalStateException("POM fails mvn validate: " + pomFile);

Try / catch

try {
    Model m = modelResolver.resolveEffectiveModel(coords);
} catch (RuntimeException e) {
    Throwable c = e.getCause();
    if (c instanceof ModelBuildingException mbe) {
        mbe.getProblems().forEach(pr -> logger.error(pr.getMessage() + " @ " + pr.getLocation()));
    }
    throw e;
}

Prevention

When it happens

Trigger: modelBuilder.build(req) in resolveEffectiveModel throwing ModelBuildingException for a POM with invalid XML, unresolvable properties/parents, or non-existent profiles/plugins referenced during building.

Common situations: Hand-edited POMs with XML mistakes or undefined ${property} interpolation, cyclic parent relationships, parent POM versions that no longer resolve, POMs using unsupported Maven model versions.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/b333829816c7d64a. Report an issue: GitHub.