elastic/elasticsearch · critical · IllegalStateException

Elasticsearch version is missing from properties.

Error message

Elasticsearch version is missing from properties.

What it means

VersionPropertiesLoader.loadBuildSrcVersion reads the elasticsearch key from the loaded Properties and throws this IllegalStateException when it is absent. Without an elasticsearch version string the loader cannot construct the project version, so this fails fast at configuration time.

Source

Thrown at build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesLoader.java:35

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

// Define this here because we need it early.
public class VersionPropertiesLoader {
    static Properties loadBuildSrcVersion(File input, ProviderFactory providerFactory) throws IOException {
        Properties props = new Properties();
        try (InputStream is = new FileInputStream(input)) {
            props.load(is);
        }
        loadBuildSrcVersion(props, providerFactory);
        return props;
    }

    protected static void loadBuildSrcVersion(Properties loadedProps, ProviderFactory providers) {
        String elasticsearch = loadedProps.getProperty("elasticsearch");
        if (elasticsearch == null) {
            throw new IllegalStateException("Elasticsearch version is missing from properties.");
        }
        if (elasticsearch.matches("[0-9]+\\.[0-9]+\\.[0-9]+") == false) {
            throw new IllegalStateException(
                    "Expected elasticsearch version to be numbers only of the form  X.Y.Z but it was: " +
                            elasticsearch
            );
        }
        String qualifier = providers.systemProperty("build.version_qualifier")
                .getOrElse("");
        if (qualifier.isEmpty() == false) {
            if (qualifier.matches("(alpha|beta|rc)\\d+") == false) {
                throw new IllegalStateException("Invalid qualifier: " + qualifier);
            }
            elasticsearch += "-" + qualifier;
        }
        final String buildSnapshotSystemProperty = providers.systemProperty("build.snapshot")
                .getOrElse("true");
        switch (buildSnapshotSystemProperty) {

View on GitHub (pinned to db6a809a66)

Solutions

  1. Open build-tools-internal/version.properties (or the configured input) and ensure a line like `elasticsearch=9.0.0` exists.
  2. Re-run generateVersionProperties or restore the file from git if it was removed.
  3. If calling loadBuildSrcVersion directly, populate the elasticsearch key before invoking it.

Example fix

// before: build-tools-internal/version.properties
# (no elasticsearch line)
// after:
elasticsearch=9.0.0
Defensive patterns

Strategy: validation

Validate before calling

Properties p = new Properties();
try (InputStream is = new FileInputStream(versionFile)) { p.load(is); }
if (p.getProperty("elasticsearch") == null) {
    throw new GradleException("version.properties is missing the 'elasticsearch' key");
}

Prevention

When it happens

Trigger: loadBuildSrcVersion(Properties, ProviderFactory) is called (directly or via the File overload) with a Properties object whose getProperty("elasticsearch") returns null. The constructor of VersionPropertiesBuildService triggers this by loading version.properties from infoPath.

Common situations: build-tools-internal/version.properties was deleted or renamed; a hand-written version.properties is missing the elasticsearch= line; a merge conflict removed the line; a downstream consumer called loadBuildSrcVersion on an empty Properties instance.

Related errors


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