{"record":{"id":"3b9f6ac637163d6f","repo":"elastic/elasticsearch","slug":"cannot-load-versionpropertiesbuildservice","errorCode":null,"errorMessage":"Cannot load VersionPropertiesBuildService","messagePattern":"Cannot load VersionPropertiesBuildService","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"critical","filePath":"build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesBuildService.java","lineNumber":38,"sourceCode":"import java.io.File;\nimport java.io.IOException;\nimport java.util.Properties;\nimport javax.inject.Inject;\n\npublic abstract class VersionPropertiesBuildService implements BuildService<VersionPropertiesBuildService.Params>, AutoCloseable {\n\n    private final Properties properties;\n\n    @Inject\n    public VersionPropertiesBuildService(ProviderFactory providerFactory) {\n        File infoPath = getParameters().getInfoPath().getAsFile().get();\n        try {\n            File propertiesInputFile = new File(infoPath, \"version.properties\");\n            properties = VersionPropertiesLoader.loadBuildSrcVersion(propertiesInputFile, providerFactory);\n            properties.computeIfAbsent(\"minimumRuntimeJava\", s -> resolveMinimumRuntimeJavaVersion(infoPath));\n            properties.computeIfAbsent(\"minimumCompilerJava\", s -> resolveMinimumCompilerJavaVersion(infoPath));\n        } catch (IOException e) {\n            throw new GradleException(\"Cannot load VersionPropertiesBuildService\", e);\n        }\n    }\n\n    private JavaVersion resolveMinimumRuntimeJavaVersion(File infoPath) {\n        return resolveJavaVersion(infoPath, \"src/main/resources/minimumRuntimeVersion\");\n    }\n\n    private JavaVersion resolveMinimumCompilerJavaVersion(File infoPath) {\n        return resolveJavaVersion(infoPath, \"src/main/resources/minimumCompilerVersion\");\n    }\n\n    private JavaVersion resolveJavaVersion(File infoPath, String path) {\n        final JavaVersion minimumJavaVersion;\n        File minimumJavaInfoSource = new File(infoPath, path);\n        try {\n            String versionString = FileUtils.readFileToString(minimumJavaInfoSource);\n            minimumJavaVersion = JavaVersion.toVersion(versionString);\n        } catch (IOException e) {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesBuildService.java#L20-L56","documentation":"VersionPropertiesBuildService is a Gradle BuildService that loads the Elasticsearch version and minimum Java toolchain requirements once per build. This GradleException is the catch-all wrapper around any IOException thrown while reading version.properties or resolving the minimumRuntime/minimumCompiler Java version files. When it fires the build cannot determine its own version, which blocks nearly every downstream task that depends on VersionProperties.","triggerScenarios":"Constructing the build service when getParameters().getInfoPath() points to a directory whose version.properties is missing or unreadable, or when the computeIfAbsent calls for minimumRuntimeJava / minimumCompilerJava hit a missing src/main/resources/minimumRuntimeVersion or minimumCompilerVersion file. Any IOException inside the try block in the constructor is rethrown as this message.","commonSituations":"Running Gradle from the wrong working directory so infoPath resolves outside the repo; a shallow/sparse checkout missing build-conventions resources; a corrupted or half-applied stash that deleted version.properties; file locked by AV/indexer on Windows; a moved checkout whose relative infoPath no longer matches.","solutions":["Inspect the caused-by IOException in the stack trace to find the exact file path that failed to read.","Verify infoPath contains version.properties and build-conventions/src/main/resources/minimumRuntimeVersion and minimumCompilerVersion.","Re-run a full clone or `git checkout -- .` to restore missing files; avoid shallow/sparse clones for the build.","Run from the repo root via the bundled ./gradlew wrapper so the infoPath parameter resolves correctly."],"exampleFix":"// before: running from a submodule dir loses the infoPath root\ngradle -p build-conventions help\n// after: run from the repo root so infoPath == repo root\n./gradlew help","handlingStrategy":"validation","validationCode":"// Run before the build service is constructed (e.g. in settings.gradle or a config check task)\nFile infoPath = new File(rootProject.projectDir, \"build-conventions\");\nFile[] required = {\n    new File(infoPath, \"version.properties\"),\n    new File(infoPath, \"src/main/resources/minimumRuntimeVersion\"),\n    new File(infoPath, \"src/main/resources/minimumCompilerVersion\")\n};\nfor (File f : required) {\n    if (!f.isFile()) {\n        throw new GradleException(\"Missing VersionPropertiesBuildService input: \" + f);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build from the repo root using the bundled ./gradlew wrapper so infoPath resolves correctly.","Avoid shallow/sparse checkouts that omit build-conventions resources.","Add a settings.gradle pre-check that verifies the required input files exist before any task configures."],"tags":["gradle","build-config","version-properties","io"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}