elastic/elasticsearch · error · IllegalArgumentException
platform not specified for jdk [${name}]
Error message
platform not specified for jdk [${name}] What it means
Thrown by Jdk.finalizeValues() when the platform Property is unset (platform.isPresent() == false). It is the second guard in finalizeValues(), reached only after the version check passes. Without a platform, the OS classifier, archive extension, and home-layout cannot be determined.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/Jdk.java:197
@Override
public String toString() {
return getHomeRoot();
}
};
}
private String getHomeRoot() {
boolean isOSX = "mac".equals(getPlatform()) || "darwin".equals(getPlatform());
return getPath() + (isOSX ? "/Contents/Home" : "");
}
// internal, make this jdks configuration unmodifiable
void finalizeValues() {
if (version.isPresent() == false) {
throw new IllegalArgumentException("version not specified for jdk [" + name + "]");
}
if (platform.isPresent() == false) {
throw new IllegalArgumentException("platform not specified for jdk [" + name + "]");
}
if (vendor.isPresent() == false) {
throw new IllegalArgumentException("vendor not specified for jdk [" + name + "]");
}
if (architecture.isPresent() == false) {
throw new IllegalArgumentException("architecture not specified for jdk [" + name + "]");
}
version.finalizeValue();
platform.finalizeValue();
vendor.finalizeValue();
architecture.finalizeValue();
distributionVersion.finalizeValue();
}
@Override
public Iterator<File> iterator() {
return configuration.iterator();
}View on GitHub (pinned to db6a809a66)
Solutions
- Add platform = '<darwin|mac|linux|windows>' to the named jdk block.
- Remove the partially-configured jdk declaration if it is unused.
Example fix
// before
jdks { j { version='21.0.3+9'; vendor='adoptium'; architecture='x64'; } }
// after
jdks { j { version='21.0.3+9'; vendor='adoptium'; architecture='x64'; platform='linux'; } } Defensive patterns
Strategy: validation
Validate before calling
// Ensure the platform property is set before resolution:
jdks {
my_jdk {
vendor = 'adoptium'
version = '21.0.3+9'
architecture = 'x64'
platform = 'linux' // <-- required, no default
}
} Prevention
- platform has no default — always set it explicitly.
- Set all four properties (version/platform/vendor/architecture) in one block.
- Remove partially-configured jdk entries you no longer use.
When it happens
Trigger: A Jdk is declared with version (and possibly vendor/architecture) but setPlatform(...) is never called, then the configuration is resolved.
Common situations: Declaring a jdk block and forgetting the platform line; relying on a default that does not exist (platform has no default).
Related errors
- version not specified for jdk [${name}]
- vendor not specified for jdk [${name}]
- architecture not specified for jdk [${name}]
- unknown vendor [${vendor}] for jdk [${name}], must be one of
- malformed version [${version}] for jdk [${name}]
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/4d7ce003550f3776.
Report an issue: GitHub.