{"record":{"id":"90c6580432bb8ee9","repo":"elastic/elasticsearch","slug":"elasticsearch-version-is-missing-from-properties","errorCode":null,"errorMessage":"Elasticsearch version is missing from properties.","messagePattern":"Elasticsearch version is missing from properties\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesLoader.java","lineNumber":35,"sourceCode":"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Properties;\n\n// Define this here because we need it early.\npublic class VersionPropertiesLoader {\n    static Properties loadBuildSrcVersion(File input, ProviderFactory providerFactory) throws IOException {\n        Properties props = new Properties();\n        try (InputStream is = new FileInputStream(input)) {\n            props.load(is);\n        }\n        loadBuildSrcVersion(props, providerFactory);\n        return props;\n    }\n\n    protected static void loadBuildSrcVersion(Properties loadedProps, ProviderFactory providers) {\n        String elasticsearch = loadedProps.getProperty(\"elasticsearch\");\n        if (elasticsearch == null) {\n            throw new IllegalStateException(\"Elasticsearch version is missing from properties.\");\n        }\n        if (elasticsearch.matches(\"[0-9]+\\\\.[0-9]+\\\\.[0-9]+\") == false) {\n            throw new IllegalStateException(\n                    \"Expected elasticsearch version to be numbers only of the form  X.Y.Z but it was: \" +\n                            elasticsearch\n            );\n        }\n        String qualifier = providers.systemProperty(\"build.version_qualifier\")\n                .getOrElse(\"\");\n        if (qualifier.isEmpty() == false) {\n            if (qualifier.matches(\"(alpha|beta|rc)\\\\d+\") == false) {\n                throw new IllegalStateException(\"Invalid qualifier: \" + qualifier);\n            }\n            elasticsearch += \"-\" + qualifier;\n        }\n        final String buildSnapshotSystemProperty = providers.systemProperty(\"build.snapshot\")\n                .getOrElse(\"true\");\n        switch (buildSnapshotSystemProperty) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesLoader.java#L17-L53","documentation":"VersionPropertiesLoader.loadBuildSrcVersion reads the elasticsearch key from the loaded Properties and throws this IllegalStateException when it is absent. Without an elasticsearch version string the loader cannot construct the project version, so this fails fast at configuration time.","triggerScenarios":"loadBuildSrcVersion(Properties, ProviderFactory) is called (directly or via the File overload) with a Properties object whose getProperty(\"elasticsearch\") returns null. The constructor of VersionPropertiesBuildService triggers this by loading version.properties from infoPath.","commonSituations":"build-tools-internal/version.properties was deleted or renamed; a hand-written version.properties is missing the elasticsearch= line; a merge conflict removed the line; a downstream consumer called loadBuildSrcVersion on an empty Properties instance.","solutions":["Open build-tools-internal/version.properties (or the configured input) and ensure a line like `elasticsearch=9.0.0` exists.","Re-run generateVersionProperties or restore the file from git if it was removed.","If calling loadBuildSrcVersion directly, populate the elasticsearch key before invoking it."],"exampleFix":"// before: build-tools-internal/version.properties\n# (no elasticsearch line)\n// after:\nelasticsearch=9.0.0","handlingStrategy":"validation","validationCode":"Properties p = new Properties();\ntry (InputStream is = new FileInputStream(versionFile)) { p.load(is); }\nif (p.getProperty(\"elasticsearch\") == null) {\n    throw new GradleException(\"version.properties is missing the 'elasticsearch' key\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat version.properties as generated; use the release tooling rather than hand edits.","Add a pre-commit hook that rejects removal of the elasticsearch= line.","When calling loadBuildSrcVersion directly, populate the key first."],"tags":["gradle","build-config","version-properties","validation"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}