{"record":{"id":"564b16fdb123dfc0","repo":"elastic/elasticsearch","slug":"cannot-read-java-properties-file","errorCode":null,"errorMessage":"Cannot read java properties file.","messagePattern":"Cannot read java properties file\\.","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcSetupExtension.java","lineNumber":278,"sourceCode":"\n        public interface Params extends ValueSourceParameters {\n            Property<String> getJdksDir();\n        }\n    }\n\n    public abstract static class JavaHomeValueSource implements ValueSource<String, JavaHomeValueSource.Params> {\n\n        private String minimumCompilerVersionPath(Version bwcVersion) {\n            return (bwcVersion.onOrAfter(BUILD_TOOL_MINIMUM_VERSION))\n                ? \"build-tools-internal/\" + MINIMUM_COMPILER_VERSION_PATH\n                : \"buildSrc/\" + MINIMUM_COMPILER_VERSION_PATH;\n        }\n\n        private static String readFromFile(File file) {\n            try {\n                return FileUtils.readFileToString(file).trim();\n            } catch (IOException ioException) {\n                throw new GradleException(\"Cannot read java properties file.\", ioException);\n            }\n        }\n\n        @Override\n        public String obtain() {\n            return readFromFile(\n                new File(getParameters().getCheckoutDir().get(), minimumCompilerVersionPath(getParameters().getVersion().get()))\n            );\n        }\n\n        public interface Params extends ValueSourceParameters {\n            Property<Version> getVersion();\n\n            Property<File> getCheckoutDir();\n        }\n    }\n\n    public abstract class BwcThrottle implements BuildService<BuildServiceParameters.None> {}","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcSetupExtension.java#L260-L296","documentation":"Thrown by BwcSetupExtension.JavaHomeValueSource.readFromFile when reading the minimum-compiler-version properties file fails with an IOException. The ValueSource reads a checked-in file (build-tools-internal/minimumCompilerVersion... or the buildSrc variant, chosen by bwc version) from the bwc checkout directory to determine the minimum Java compiler for a backward-compatibility build.","triggerScenarios":"The minimum-compiler-version file is missing, unreadable, or the checkout directory parameter points at a non-existent or incomplete path; FileUtils.readFileToString throws IOException.","commonSituations":"Incomplete bwc git checkout; the checkoutDir ValueSource parameter was never set or points at a stale path; file permissions block read; the file was moved/renamed in a branch mismatch.","solutions":["Verify the bwc checkout directory exists and contains build-tools-internal/<minimumCompilerVersion path>.","Ensure getCheckoutDir() ValueSource parameter is set to the correct checkout root.","Re-create or refresh the bwc checkout used by the build.","Check read permissions on the target file."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"File f = new File(checkoutDir, minimumCompilerVersionPath);\nif (f.exists() == false || f.canRead() == false) {\n    throw new GradleException(\"Cannot read java properties file at \" + f.getAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"try {\n    return FileUtils.readFileToString(file).trim();\n} catch (IOException ioException) {\n    throw new GradleException(\"Cannot read java properties file.\", ioException);\n}","preventionTips":["Verify the bwc checkout directory is complete before starting a BWC build.","Set the checkoutDir ValueSource parameter explicitly to a known-good path.","Check read permissions on checked-in properties files."],"tags":["bwc","io","value-source","build-tools"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}