apache/maven · warning · IllegalArgumentException

Repository list contains null entries. All repository entrie

Error message

Repository list contains null entries. All repository entries must be non-null RemoteRepository instances.

What it means

While building the dependency graph, MavenMetadataSource must retrieve and parse the POM of each dependency to compute transitive dependencies. When that POM cannot be retrieved or parsed, Maven logs this warning (the underlying exception text is appended only when running with -X) and continues the build with NO transitive dependencies for that artifact. The damage surfaces later as compilation errors, NoClassDefFoundError at runtime, or missing packages.

Source

Thrown at api/maven-api-core/src/main/java/org/apache/maven/api/services/RepositoryAwareRequest.java:112

     *
     * @param repositories the list of repositories to validate, may be {@code null}
     * @return the same list if validation passes, or {@code null} if input was {@code null}
     * @throws IllegalArgumentException if the list contains duplicate repositories
     * @throws IllegalArgumentException if the list contains null repository entries
     */
    default List<RemoteRepository> validate(List<RemoteRepository> repositories) {
        if (repositories == null) {
            return null;
        }
        HashSet<RemoteRepository> set = new HashSet<>(repositories);
        if (repositories.size() != set.size()) {
            throw new IllegalArgumentException(
                    "Repository list contains duplicate entries. Each repository must be unique based on its ID and URL. "
                            + "Found " + repositories.size() + " repositories but only " + set.size()
                            + " unique entries.");
        }
        if (repositories.stream().anyMatch(Objects::isNull)) {
            throw new IllegalArgumentException(
                    "Repository list contains null entries. All repository entries must be non-null RemoteRepository instances.");
        }
        return repositories;
    }
}

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Delete the artifact's directory under ~/.m2/repository and rebuild with mvn -U so a clean copy is fetched
  2. Run mvn -X and read the exception appended to the warning to see whether retrieval, parsing, or parent resolution failed
  3. Verify the remote actually serves the POM: curl -fL <repoUrl>/<groupPath>/<artifactId>/<version>/<artifactId>-<version>.pom
  4. If the artifact legitimately has no usable POM, declare the libraries you consumed transitively as direct dependencies yourself

Example fix

# before
mvn clean install   # warns: Invalid POM for com.example:lib:1.0, transitive deps missing
# after
rm -rf ~/.m2/repository/com/example/lib
mvn -U clean install
Defensive patterns

Strategy: validation

Validate before calling

pom=~/.m2/repository/com/example/lib/1.0/lib-1.0.pom
if [ -f $pom ] && ! xmllint --noout $pom; then
  rm -rf $(dirname $pom)   # drop corrupt copy; next build re-fetches with -U
fi

Prevention

When it happens

Trigger: A dependency whose POM in the local repository is corrupt or truncated (an HTML error page cached as a .pom), whose parent POM is unresolvable, or that is served by a misconfigured repository or proxy; also artifacts published without a usable POM.

Common situations: Broken mirrors caching bad files; corporate proxies returning login pages with HTTP 200; partial downloads after interrupted builds; artifacts relocated or repackaged upstream; local repository corruption after disk-full events.

Related errors


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