elastic/elasticsearch · error · IllegalStateException

Invalid qualifier: ${qualifier}

Error message

Invalid qualifier: ${qualifier}

What it means

When the build.version_qualifier system property is non-empty, the loader requires it to match (alpha|beta|rc)\d+ (e.g. alpha1, beta2, rc3). Any other value — wrong casing, missing digit, or an unrelated string — is rejected so the constructed version stays parseable.

Source

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

        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) {
            case "true":
                elasticsearch += "-SNAPSHOT";
                break;
            case "false":
                // do nothing
                break;
            default:
                throw new IllegalArgumentException(
                        "build.snapshot was set to [" + buildSnapshotSystemProperty + "] but can only be unset or [true|false]");
        }
        loadedProps.put("elasticsearch", elasticsearch);
    }

View on GitHub (pinned to db6a809a66)

Solutions

  1. Set the qualifier to a value matching alpha|beta followed by digits, e.g. -Dbuild.version_qualifier=beta1.
  2. Omit the property entirely if you want a plain release/SNAPSHOT version.
  3. Strip whitespace and lowercase the value before passing it.

Example fix

// before
./gradlew build -Dbuild.version_qualifier=Beta1
// after
./gradlew build -Dbuild.version_qualifier=beta1
Defensive patterns

Strategy: validation

Validate before calling

String q = System.getProperty("build.version_qualifier", "");
if (!q.isEmpty() && !q.matches("(alpha|beta|rc)\\d+")) {
    throw new GradleException("Invalid build.version_qualifier: " + q);
}

Prevention

When it happens

Trigger: Running Gradle with -Dbuild.version_qualifier set to something like alpha, rc, snapshot, m1, or Alpha1 (case-sensitive, capital A fails the regex).

Common situations: A CI pipeline passes a milestone-style qualifier the regex does not allow; a developer experiments with -Dbuild.version_qualifier=dev; a release script uppercases the qualifier; trailing whitespace in the value breaks the match.

Related errors


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