{"record":{"id":"2f532463ea33a564","repo":"elastic/elasticsearch","slug":"version-not-specified-for-jdk-name","errorCode":null,"errorMessage":"version not specified for jdk [${name}]","messagePattern":"version not specified for jdk \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/Jdk.java","lineNumber":194,"sourceCode":"\n    public Object getJavaHomePath() {\n        return new Object() {\n            @Override\n            public String toString() {\n                return getHomeRoot();\n            }\n        };\n    }\n\n    private String getHomeRoot() {\n        boolean isOSX = \"mac\".equals(getPlatform()) || \"darwin\".equals(getPlatform());\n        return getPath() + (isOSX ? \"/Contents/Home\" : \"\");\n    }\n\n    // internal, make this jdks configuration unmodifiable\n    void finalizeValues() {\n        if (version.isPresent() == false) {\n            throw new IllegalArgumentException(\"version not specified for jdk [\" + name + \"]\");\n        }\n        if (platform.isPresent() == false) {\n            throw new IllegalArgumentException(\"platform not specified for jdk [\" + name + \"]\");\n        }\n        if (vendor.isPresent() == false) {\n            throw new IllegalArgumentException(\"vendor not specified for jdk [\" + name + \"]\");\n        }\n        if (architecture.isPresent() == false) {\n            throw new IllegalArgumentException(\"architecture not specified for jdk [\" + name + \"]\");\n        }\n        version.finalizeValue();\n        platform.finalizeValue();\n        vendor.finalizeValue();\n        architecture.finalizeValue();\n        distributionVersion.finalizeValue();\n    }\n\n    @Override","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/Jdk.java#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\njdks { my_jdk { vendor='adoptium'; platform='linux'; architecture='x64'; } }\n// after\njdks { my_jdk { vendor='adoptium'; platform='linux'; architecture='x64'; version='21.0.3+9'; } }","handlingStrategy":"validation","validationCode":"// Structural check before resolving the jdk configuration:\nvoid assertJdkFullyConfigured(Jdk jdk) {\n    if (jdk.getVersion() == null) {  // or track presence at the Property level\n        throw new IllegalStateException(\"Jdk \" + jdk.getName() + \" missing version\");\n    }\n}\n// In Gradle DSL, always specify all four: version, platform, vendor, architecture.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["gradle","jdk","build-config","validation","missing-property"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}