apache/maven · error · UnresolvableModelException

No versions matched the requested parent version range '%s'

Error message

No versions matched the requested parent version range '%s'

What it means

DefaultModelResolver.resolveModel(Parent) expands a version range in <parent><version> via the version-range resolver. When no available version in the reachable repositories matches the range, highestVersion is null and it throws UnresolvableModelException carrying the parent GAV and the requested range.

Source

Thrown at compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java:182

        Path pomFile = pomArtifact.getPath();

        return new FileModelSource(pomFile);
    }

    @Override
    public ModelSource resolveModel(final Parent parent) throws UnresolvableModelException {
        try {
            final Artifact artifact =
                    new DefaultArtifact(parent.getGroupId(), parent.getArtifactId(), "", "pom", parent.getVersion());

            final VersionRangeRequest versionRangeRequest = new VersionRangeRequest(artifact, repositories, context);
            versionRangeRequest.setTrace(trace);

            final VersionRangeResult versionRangeResult =
                    versionRangeResolver.resolveVersionRange(session, versionRangeRequest);

            if (versionRangeResult.getHighestVersion() == null) {
                throw new UnresolvableModelException(
                        String.format(
                                "No versions matched the requested parent version range '%s'", parent.getVersion()),
                        parent.getGroupId(),
                        parent.getArtifactId(),
                        parent.getVersion());
            }

            if (versionRangeResult.getVersionConstraint() != null
                    && versionRangeResult.getVersionConstraint().getRange() != null
                    && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null) {
                // Message below is checked for in the MNG-2199 core IT.
                throw new UnresolvableModelException(
                        String.format(
                                "The requested parent version range '%s' does not specify an upper bound",
                                parent.getVersion()),
                        parent.getGroupId(),
                        parent.getArtifactId(),
                        parent.getVersion());

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Check the range bounds against versions that actually exist (repository listing or mvn versions:display-parent-updates)
  2. Fix or widen the range, or replace it with a concrete version like 1.8
  3. Ensure the repository hosting the parent is declared in the build and reachable (check mirrors and auth)
  4. If offline (-o), pre-warm the local repository with the parent's metadata and artifact

Example fix

<!-- before: range matches no published parent version -->
<parent>
  <groupId>com.example</groupId>
  <artifactId>platform</artifactId>
  <version>[2.0,2.5)</version> <!-- only 2.5+ exists -->
</parent>

<!-- after: use a version that exists (or fix the bounds) -->
<parent>
  <groupId>com.example</groupId>
  <artifactId>platform</artifactId>
  <version>2.6</version>
</parent>
Defensive patterns

Strategy: try-catch

Validate before calling

// Fail fast on malformed parent ranges before model building
try {
    org.apache.maven.artifact.versioning.VersionRange.createFromVersionSpec(parent.getVersion());
} catch (InvalidVersionSpecificationException e) {
    throw new IllegalArgumentException("Malformed parent version range: " + parent.getVersion(), e);
}

Try / catch

try {
    ModelSource parentSource = modelResolver.resolveModel(parent);
} catch (UnresolvableModelException e) {
    // e carries groupId/artifactId/version of the parent: surface a targeted message
    throw new BuildFailureException(
        "Parent " + e.getGroupId() + ":" + e.getArtifactId() + ":" + e.getVersion()
        + " not found for range in <parent>; check bounds and repositories", e);
}

Prevention

When it happens

Trigger: A POM whose <parent><version> is a range like [1.5,1.9) while no version in any reachable repository falls inside the range, or the parent was never deployed at all.

Common situations: Parent artifact not published to the configured repositories; range bounds typo'd so they exclude every existing version; offline or air-gapped builds missing range metadata; parent only available via a deactivated profile or repository.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/e5fae8747d007158. Report an issue: GitHub.