elastic/elasticsearch · critical · IllegalStateException

Parsed versions latest version does not match the one config

Error message

Parsed versions latest version does not match the one configured in build properties. Parsed latest version is {} but the build has {}

What it means

Thrown by BwcVersions.assertCurrentVersionMatchesParsed when the last entry in the parsed version list does not equal the Version.CURRENT configured in build properties. The build's notion of the current version must agree with the latest parsed version; a mismatch indicates an inconsistent version bump.

Source

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

    private final Version currentVersion;
    private final transient List<Version> versions;
    private final Map<Version, UnreleasedVersionInfo> unreleased;

    public BwcVersions(Version currentVersionProperty, List<Version> allVersions, List<DevelopmentBranch> developmentBranches) {
        if (allVersions.isEmpty()) {
            throw new IllegalArgumentException("Could not parse any versions");
        }

        this.versions = allVersions;
        this.currentVersion = allVersions.get(allVersions.size() - 1);
        assertCurrentVersionMatchesParsed(currentVersionProperty);

        this.unreleased = computeUnreleased(developmentBranches);
    }

    private void assertCurrentVersionMatchesParsed(Version currentVersionProperty) {
        if (currentVersionProperty.equals(currentVersion) == false) {
            throw new IllegalStateException(
                "Parsed versions latest version does not match the one configured in build properties. "
                    + "Parsed latest version is "
                    + currentVersion
                    + " but the build has "
                    + currentVersionProperty
            );
        }
    }

    /**
     * Returns info about the unreleased version, or {@code null} if the version is released.
     */
    public UnreleasedVersionInfo unreleasedInfo(Version version) {
        return unreleased.get(version);
    }

    public void forPreviousUnreleased(Consumer<UnreleasedVersionInfo> consumer) {
        getUnreleased().stream().filter(version -> version.equals(currentVersion) == false).map(unreleased::get).forEach(consumer);

View on GitHub (pinned to db6a809a66)

Solutions

  1. Update Version.java CURRENT to match the parsed latest version.
  2. Re-run the version-metadata generation task after a version bump.
  3. Clean the build cache and rebuild so parsing re-runs.
  4. Verify you are on the intended branch with a consistent version set.
Defensive patterns

Strategy: validation

Validate before calling

if (currentVersionProperty.equals(currentVersion) == false) {
    throw new IllegalStateException("Parsed latest " + currentVersion + " != configured " + currentVersionProperty);
}

Prevention

When it happens

Trigger: Version.java CURRENT was updated to a new number but the parsed version list's last entry (or vice versa) was not updated to match - one source of truth changed, the other did not.

Common situations: Half-finished version bump across branches; merging a version change without the corresponding metadata update; branch switched but stale build cache.

Related errors


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