elastic/elasticsearch · critical · IllegalStateException

out-of-date released versions Build considers versions unrel

Error message

out-of-date released versions
Build considers versions unreleased, but they are released according to an authoritative source: {}
The next versions probably needs to be added to Version.java (CURRENT doesn't count).

What it means

Thrown by BwcVersions.compareToAuthoritative when the authoritative source considers versions released that the build still treats as unreleased. Per the project convention, when a version ships the next version must be added to Version.java; this error says that follow-up was missed.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcVersions.java:190

                        )
                    );
    }

    public void compareToAuthoritative(List<Version> authoritativeReleasedVersions) {
        Set<Version> notReallyReleased = new HashSet<>(getReleased());
        notReallyReleased.removeAll(authoritativeReleasedVersions);
        if (notReallyReleased.isEmpty() == false) {
            throw new IllegalStateException(
                "out-of-date released versions"
                    + "\nFollowing versions are not really released, but the build thinks they are: "
                    + notReallyReleased
            );
        }

        Set<Version> incorrectlyConsideredUnreleased = new HashSet<>(authoritativeReleasedVersions);
        incorrectlyConsideredUnreleased.retainAll(getUnreleased());
        if (incorrectlyConsideredUnreleased.isEmpty() == false) {
            throw new IllegalStateException(
                "out-of-date released versions"
                    + "\nBuild considers versions unreleased, "
                    + "but they are released according to an authoritative source: "
                    + incorrectlyConsideredUnreleased
                    + "\nThe next versions probably needs to be added to Version.java (CURRENT doesn't count)."
            );
        }
    }

    public List<Version> getReleased() {
        return versions.stream()
            .filter(v -> v.getMajor() >= currentVersion.getMajor() - 1)
            .filter(v -> unreleased.containsKey(v) == false)
            .toList();
    }

    public List<Version> getReadOnlyIndexCompatible() {
        // Lucene can read indices in version N-2

View on GitHub (pinned to db6a809a66)

Solutions

  1. Add the next unreleased version to Version.java as the message instructs (CURRENT does not count).
  2. Mark the now-released version as released in build metadata.
  3. Pull the latest from the release branch and re-run the version sanity check.
Defensive patterns

Strategy: validation

Validate before calling

Set<Version> wrong = new HashSet<>(authoritativeReleasedVersions);
wrong.retainAll(getUnreleased());
if (wrong.isEmpty() == false) {
    throw new IllegalStateException("Add next version to Version.java: " + wrong);
}

Prevention

When it happens

Trigger: A version was published to Maven Central but Version.java (and the derived unreleased set) was never updated to add the successor version, so the build still lists a now-released version as unreleased.

Common situations: Release completed but the repository's Version.java was not updated; merge of the release branch omitted the version-metadata follow-up.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/55616c1f8153c258. Report an issue: GitHub.