elastic/elasticsearch · error · IllegalArgumentException
platform cannot be set on elasticsearch distribution [${name
Error message
platform cannot be set on elasticsearch distribution [${name}] of type [integ_test_zip] What it means
finalizeValues rejects setting platform on an INTEG_TEST_ZIP distribution: the integ-test zip is platform-independent, so pinning a platform is a configuration error. The check fires when the distribution is frozen (via maybeFreeze, triggered by getFilepath/getBuildDependencies/iterator).
Source
Thrown at build-tools/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java:232
: configuration.getBuildDependencies();
}
}
private boolean skippingDockerDistributionBuild() {
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) {View on GitHub (pinned to db6a809a66)
Solutions
- Do not call setPlatform for integ_test_zip distributions.
- Branch on type before applying platform: only set it for ARCHIVE.
- Remove the platform line from the distribution configuration block that targets integ_test_zip.
Example fix
// before distribution.type = ElasticsearchDistributionTypes.INTEG_TEST_ZIP distribution.platform = Platform.LINUX // rejected on freeze // after distribution.type = ElasticsearchDistributionTypes.INTEG_TEST_ZIP // no platform line — integ_test_zip is platform-independent
Defensive patterns
Strategy: validation
Validate before calling
if (distribution.getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP && distribution.getPlatform() != null) {
throw new IllegalArgumentException("platform must not be set on integ_test_zip");
} Type guard
static boolean platformAllowed(ElasticsearchDistribution d) {
return d.getType() != ElasticsearchDistributionTypes.INTEG_TEST_ZIP;
} Prevention
- Only set platform for ARCHIVE distributions.
- Centralise distribution configuration so platform is applied conditionally on type.
- Write a quick unit test asserting integ_test_zip rejects platform.
When it happens
Trigger: Calling setPlatform(...) on a distribution whose type is (or will be) INTEG_TEST_ZIP, then triggering finalization — directly or by reading a property that calls maybeFreeze.
Common situations: A build block unconditionally sets platform on every distribution including the integ-test zip; a refactor changed the type to integ_test_zip but left the platform line; a shared helper applies platform defaults to all distributions.
Related errors
- Cannot set Elasticsearch Distribution type to ${type}. Type
- bundledJdk cannot be set on elasticsearch distribution [${na
- failIfUnavailable cannot be 'false' on elasticsearch distrib
- License category name must be exactly 5 characters, got ${ca
- distribution type [${typeName}] for elasticsearch distributi
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/763eb701d18409dd.
Report an issue: GitHub.