elastic/elasticsearch · error · IllegalArgumentException
version not specified for jdk [${name}]
Error message
version not specified for jdk [${name}] What it means
Thrown by Jdk.finalizeValues() when the version Property has never been set (version.isPresent() == false). finalizeValues() is invoked lazily when the jdk configuration resolves its default dependencies (see JdkDownloadPlugin), so this surfaces at resolution time, not at configuration time — the error identifies the jdk by its container name.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/Jdk.java:194
public Object getJavaHomePath() {
return new Object() {
@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();
}
@OverrideView on GitHub (pinned to db6a809a66)
Solutions
- Add version = '<valid version string>' (see error 162 format) to the named jdk block.
- If the jdk is no longer needed, remove the declaration from the jdks container instead of leaving it partially configured.
- Ensure the version assignment is not guarded by a condition that evaluated false.
Example fix
// before
jdks { my_jdk { vendor='adoptium'; platform='linux'; architecture='x64'; } }
// after
jdks { my_jdk { vendor='adoptium'; platform='linux'; architecture='x64'; version='21.0.3+9'; } } Defensive patterns
Strategy: validation
Validate before calling
// Structural check before resolving the jdk configuration:
void assertJdkFullyConfigured(Jdk jdk) {
if (jdk.getVersion() == null) { // or track presence at the Property level
throw new IllegalStateException("Jdk " + jdk.getName() + " missing version");
}
}
// In Gradle DSL, always specify all four: version, platform, vendor, architecture. Prevention
- Always set version, platform, vendor, and architecture together in a jdk block.
- If you template jdk blocks, validate all four keys are present before applying.
- Remove unused jdk declarations rather than leaving them partially configured.
When it happens
Trigger: A Jdk named <name> is declared in the jdks container but setVersion(...) is never called. When any task resolves the jdk's configuration, the defaultDependencies callback runs jdk.finalizeValues(), which checks version.isPresent() first.
Common situations: Declaring a jdk block with only vendor/platform/architecture and forgetting the version; renaming a version property and leaving the jdk block empty; conditional configuration where the version-assignment branch wasn't taken.
Related errors
- platform 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/2f532463ea33a564.
Report an issue: GitHub.