elastic/elasticsearch · error · IllegalArgumentException
bundledJdk cannot be set on elasticsearch distribution [${na
Error message
bundledJdk cannot be set on elasticsearch distribution [${name}] of type [docker] What it means
Thrown by ElasticsearchDistribution.finalizeValues() when a DOCKER-type distribution has its `bundledJdk` property explicitly set. Docker images ship with a JDK baked into the image layer, so toggling bundledJdk has no effect and the option is forbidden to prevent silent misconfiguration. Only archive/rpm/deb distributions honor bundledJdk (and default it to true).
Source
Thrown at build-tools/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java:263
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
if (platform.isPresent()) {
throw new IllegalArgumentException(
"platform cannot be set on elasticsearch distribution [" + name + "] of type [" + getType() + "]"
);
}
if (isDocker()) {
if (bundledJdk.isPresent()) {
throw new IllegalArgumentException(
"bundledJdk cannot be set on elasticsearch distribution [" + name + "] of type " + "[docker]"
);
}
}
}
if (bundledJdk.isPresent() == false) {
bundledJdk.set(true);
}
version.finalizeValue();
platform.finalizeValue();
type.finalizeValue();
bundledJdk.finalizeValue();
}
}
View on GitHub (pinned to db6a809a66)
Solutions
- Remove the setBundledJdk(...) call from the docker distribution configuration.
- If you need a different JDK in docker, build a custom image rather than toggling bundledJdk.
- Reserve bundledJdk configuration for archive/rpm/deb distributions only.
Example fix
// before
distributions {
docker {
bundledJdk = false // throws: docker always bundles its own JDK
}
}
// after
distributions {
docker {
// bundledJdk left unset; image JDK is used
}
} Defensive patterns
Strategy: validation
Validate before calling
ElasticsearchDistribution dist = ...;
if (dist.isDocker()) {
assert dist.getBundledJdk() == null : "bundledJdk must not be set on docker distribution " + dist.getName();
} Prevention
- Treat bundledJdk as archive/rpm/deb-only; docker images bundle their own JDK.
- Add a comment on any bundledJdk setting noting which distribution types permit it.
- When migrating a distribution to docker, audit for platform and bundledJdk lines to remove.
When it happens
Trigger: Calling setBundledJdk(...) on an ElasticsearchDistribution whose isDocker() is true, then triggering finalizeValues(). The check fires inside the `else` branch (non-archive) under `if (isDocker())`.
Common situations: Carrying over a bundledJdk=false setting (common for slim archive dists) when switching a distribution to docker; assuming bundledJdk is uniformly configurable across all distribution types.
Related errors
- platform cannot be set on elasticsearch distribution [${name
- Capturing output is not supported when indentingConsoleOutpu
- Capturing output was not enabled. Use ${name}.getCapturedOut
- Cannot set commandline with empty list.
- No condition specified for ${missingOS}
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/accc37927f9c9eaa.
Report an issue: GitHub.