elastic/elasticsearch · error · IllegalArgumentException

bundledJdk cannot be set on elasticsearch distribution [${na

Error message

bundledJdk cannot be set on elasticsearch distribution [${name}] of type [integ_test_zip]

What it means

Symmetric to the platform check, finalizeValues rejects setting bundledJdk on an INTEG_TEST_ZIP distribution because the integ-test zip does not bundle a JDK. bundledJdk is only meaningful for the platform-specific distribution types. The check reads bundledJdk.getOrNull() so a non-null value — including an explicit true — trips it.

Source

Thrown at build-tools/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java:237

        return isDocker() && getFailIfUnavailable() == false && dockerAvailability.get() == false;
    }

    @Override
    public Iterator<File> iterator() {
        maybeFreeze();
        return getType().shouldExtract() ? extracted.iterator() : configuration.iterator();
    }

    // internal, make this distribution's configuration unmodifiable
    void finalizeValues() {
        if (getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP) {
            if (platform.getOrNull() != null) {
                throw new IllegalArgumentException(
                    "platform cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]"
                );
            }
            if (bundledJdk.getOrNull() != null) {
                throw new IllegalArgumentException(
                    "bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type [integ_test_zip]"
                );
            }
            return;
        }

        if (isDocker() == false && failIfUnavailable.get() == false) {
            throw new IllegalArgumentException(
                "failIfUnavailable cannot be 'false' on elasticsearch distribution [" + name + "] of type [" + getType() + "]"
            );
        }

        if (getType() == ElasticsearchDistributionTypes.ARCHIVE) {
            // defaults for archive, set here instead of via convention so integ-test-zip can verify they are not set
            if (platform.isPresent() == false) {
                platform.set(CURRENT_PLATFORM);
            }
        } else { // rpm, deb or docker

View on GitHub (pinned to db6a809a66)

Solutions

  1. Do not call setBundledJdk for integ_test_zip distributions.
  2. Gate the call: only set bundledJdk when type is ARCHIVE/RPM/DEB/DOCKER (and note docker also rejects it later).
  3. Drop the bundledJdk line from the configuration block for integ_test_zip.

Example fix

// before
distribution.type = ElasticsearchDistributionTypes.INTEG_TEST_ZIP
distribution.bundledJdk = true
// after
distribution.type = ElasticsearchDistributionTypes.INTEG_TEST_ZIP
// bundledJdk must stay unset for integ_test_zip
Defensive patterns

Strategy: validation

Validate before calling

if (distribution.getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP && distribution.getBundledJdk() != ...) {
    // simpler: do not call setBundledJdk for integ_test_zip at all
}

Type guard

static boolean bundledJdkAllowed(ElasticsearchDistribution d) {
    return d.getType() != ElasticsearchDistributionTypes.INTEG_TEST_ZIP;
}

Prevention

When it happens

Trigger: Calling setBundledJdk(...) on an INTEG_TEST_ZIP distribution, then triggering maybeFreeze (via getFilepath, getBuildDependencies, iterator, or another freeze site).

Common situations: A convention that sets bundledJdk=true on every distribution also hits the integ-test zip; a copy-pasted configuration block; a refactor to integ_test_zip that left the bundledJdk line.

Related errors


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