apache/maven · error · VersionRangeResolverException
Unable to resolve version range
Error message
Unable to resolve version range
What it means
DefaultVersionRangeResolver delegates to the resolver's version range resolution and wraps any VersionRangeResolutionException in VersionRangeResolverException("Unable to resolve version range"). The failure means the range expression itself could not be evaluated against the available version metadata: unsatisfiable or malformed bounds (e.g. inverted ranges, unbounded '[1.0)'), or repository metadata (maven-metadata.xml) that could not be read.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultVersionRangeResolver.java:114
@Override
public List<Version> getVersions() {
return map(res.getVersions(), v -> session.parseVersion(v.toString()));
}
@Override
public Optional<Repository> getRepository(Version version) {
ArtifactRepository repo = repos.get(version.toString());
if (repo instanceof org.eclipse.aether.repository.LocalRepository localRepository) {
return Optional.of(new DefaultLocalRepository(localRepository));
} else if (repo instanceof org.eclipse.aether.repository.RemoteRepository remoteRepository) {
return Optional.of(new DefaultRemoteRepository(remoteRepository));
} else {
return Optional.empty();
}
}
};
} catch (VersionRangeResolutionException e) {
throw new VersionRangeResolverException("Unable to resolve version range", e);
} finally {
RequestTraceHelper.exit(trace);
}
}
private Metadata.Nature toResolver(VersionRangeResolverRequest.Nature nature) {
return switch (nature) {
case RELEASE_OR_SNAPSHOT -> Metadata.Nature.RELEASE_OR_SNAPSHOT;
case SNAPSHOT -> Metadata.Nature.SNAPSHOT;
case RELEASE -> Metadata.Nature.RELEASE;
};
}
}
View on GitHub (pinned to e4093d4e12)
Solutions
- Unwrap the cause (VersionRangeResolutionException) — its message names the exact range problem
- Verify the range syntax: well-formed '[1.0,2.0)', '(,1.0]', and a resolvable upper bound
- Check that at least one version inside the range actually exists in the configured repositories (browse the remote maven-metadata.xml)
- Refresh metadata (delete the stale local copy under ~/.m2/repository/.../maven-metadata-*.xml) and confirm mirrors are reachable
Example fix
<!-- before: inverted / unsatisfiable range --> <dependency> <groupId>com.acme</groupId> <artifactId>core</artifactId> <version>[2.0,1.0)</version> </dependency> <!-- after: satisfiable range backed by real versions --> <dependency> <groupId>com.acme</groupId> <artifactId>core</artifactId> <version>[1.0,2.0)</version> </dependency>
Defensive patterns
Strategy: try-catch
Validate before calling
// sanity-check the range expression before resolving it
try {
org.eclipse.aether.version.VersionRange.parse("[1.0,2.0)"); // or Maven's VersionConstraint parser
} catch (InvalidVersionSpecificationException e) {
throw new IllegalArgumentException("Bad version range: " + e.getMessage(), e);
} Try / catch
try {
VersionRangeResult r = versionRangeResolver.resolve(session, request);
} catch (VersionRangeResolverException e) {
if (e.getCause() instanceof org.eclipse.aether.resolution.VersionRangeResolutionException vr) {
log.warn("Range {} unresolvable: {}", range, vr.getMessage());
return fallbackVersion(); // e.g. pin a known-good version
}
throw e;
} Prevention
- Prefer pinned versions; treat ranges as opt-in and document them
- Verify a resolvable version inside the range exists before shipping the range
- Validate range syntax in a unit test so typos fail at build time, not resolution time
When it happens
Trigger: versionRangeResolver.resolve(session, request) with a range like '[1.5,1.0)' (lower bound above upper), '[1.0)' (missing upper bound the resolver refuses), or when maven-metadata.xml listing available versions is missing/unreachable in every repository of the request.
Common situations: Dependency or plugin version ranges referencing versions absent from all reachable repositories; mirrors/proxies serving stale or partial metadata; range syntax typos in pom.xml; air-gapped environments where metadata cannot be fetched.
Related errors
- Unable to resolve version
- Unable to get dependency information: " + e.getMessage()
- No versions are present in the repository for the artifact w
- Error updating group repository metadata
- Cannot read metadata from '{}': {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/15729b6da18cdda8.
Report an issue: GitHub.