{"record":{"id":"e00b77bca1666ee1","repo":"elastic/elasticsearch","slug":"bundledjdk-cannot-be-set-on-elasticsearch-distribu","errorCode":null,"errorMessage":"bundledJdk cannot be set on elasticsearch distribution [${name}] of type [integ_test_zip]","messagePattern":"bundledJdk cannot be set on elasticsearch distribution \\[(.+?)\\] of type \\[integ_test_zip\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-tools/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java","lineNumber":237,"sourceCode":"        return isDocker() && getFailIfUnavailable() == false && dockerAvailability.get() == false;\n    }\n\n    @Override\n    public Iterator<File> iterator() {\n        maybeFreeze();\n        return getType().shouldExtract() ? extracted.iterator() : configuration.iterator();\n    }\n\n    // internal, make this distribution's configuration unmodifiable\n    void finalizeValues() {\n        if (getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP) {\n            if (platform.getOrNull() != null) {\n                throw new IllegalArgumentException(\n                    \"platform cannot be set on elasticsearch distribution [\" + name + \"] of type [integ_test_zip]\"\n                );\n            }\n            if (bundledJdk.getOrNull() != null) {\n                throw new IllegalArgumentException(\n                    \"bundledJdk cannot be set on elasticsearch distribution [\" + name + \"] of type [integ_test_zip]\"\n                );\n            }\n            return;\n        }\n\n        if (isDocker() == false && failIfUnavailable.get() == false) {\n            throw new IllegalArgumentException(\n                \"failIfUnavailable cannot be 'false' on elasticsearch distribution [\" + name + \"] of type [\" + getType() + \"]\"\n            );\n        }\n\n        if (getType() == ElasticsearchDistributionTypes.ARCHIVE) {\n            // defaults for archive, set here instead of via convention so integ-test-zip can verify they are not set\n            if (platform.isPresent() == false) {\n                platform.set(CURRENT_PLATFORM);\n            }\n        } else { // rpm, deb or docker","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java#L219-L255","documentation":"Symmetric to the platform check, finalizeValues rejects setting bundledJdk on an INTEG_TEST_ZIP distribution because the integ-test zip does not bundle a JDK. bundledJdk is only meaningful for the platform-specific distribution types. The check reads bundledJdk.getOrNull() so a non-null value — including an explicit true — trips it.","triggerScenarios":"Calling setBundledJdk(...) on an INTEG_TEST_ZIP distribution, then triggering maybeFreeze (via getFilepath, getBuildDependencies, iterator, or another freeze site).","commonSituations":"A convention that sets bundledJdk=true on every distribution also hits the integ-test zip; a copy-pasted configuration block; a refactor to integ_test_zip that left the bundledJdk line.","solutions":["Do not call setBundledJdk for integ_test_zip distributions.","Gate the call: only set bundledJdk when type is ARCHIVE/RPM/DEB/DOCKER (and note docker also rejects it later).","Drop the bundledJdk line from the configuration block for integ_test_zip."],"exampleFix":"// before\ndistribution.type = ElasticsearchDistributionTypes.INTEG_TEST_ZIP\ndistribution.bundledJdk = true\n// after\ndistribution.type = ElasticsearchDistributionTypes.INTEG_TEST_ZIP\n// bundledJdk must stay unset for integ_test_zip","handlingStrategy":"validation","validationCode":"if (distribution.getType() == ElasticsearchDistributionTypes.INTEG_TEST_ZIP && distribution.getBundledJdk() != ...) {\n    // simpler: do not call setBundledJdk for integ_test_zip at all\n}","typeGuard":"static boolean bundledJdkAllowed(ElasticsearchDistribution d) {\n    return d.getType() != ElasticsearchDistributionTypes.INTEG_TEST_ZIP;\n}","tryCatchPattern":null,"preventionTips":["Never call setBundledJdk on integ_test_zip distributions.","Gauge configuration blocks on type before setting type-specific properties.","Note docker also rejects bundledJdk later in finalizeValues."],"tags":["gradle","distribution","validation","build-script"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}