{"record":{"id":"435dbf9b5f69de17","repo":"elastic/elasticsearch","slug":"unable-to-resolve-to-resolve-bwc-versions-from-ver","errorCode":null,"errorMessage":"Unable to resolve to resolve bwc versions from versionsFile.","messagePattern":"Unable to resolve to resolve bwc versions from versionsFile\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java","lineNumber":203,"sourceCode":"\n    private String formatJavaVendorDetails(JvmInstallationMetadata runtimeJdkMetaData) {\n        JvmVendor vendor = runtimeJdkMetaData.getVendor();\n        return runtimeJdkMetaData.getVendor().getKnownVendor().name() + \"/\" + vendor.getRawVendor();\n    }\n\n    /* Introspect all versions of ES that may be tested against for backwards\n     * compatibility. It is *super* important that this logic is the same as the\n     * logic in VersionUtils.java. */\n    private BwcVersions resolveBwcVersions(Version currentElasticsearchVersion) {\n        String versionsFilePath = elvis(\n            System.getProperty(\"BWC_VERSION_SOURCE\"),\n            new File(Util.locateElasticsearchWorkspace(project.getGradle()), DEFAULT_VERSION_JAVA_FILE_PATH).getPath()\n        );\n        try (var is = new FileInputStream(versionsFilePath)) {\n            List<String> versionLines = IOUtils.readLines(is, \"UTF-8\");\n            return new BwcVersions(currentElasticsearchVersion, parseVersionLines(versionLines), getDevelopmentBranches());\n        } catch (IOException e) {\n            throw new IllegalStateException(\"Unable to resolve to resolve bwc versions from versionsFile.\", e);\n        }\n    }\n\n    private List<Version> parseVersionLines(List<String> versionLines) {\n        return versionLines.stream()\n            .map(LINE_PATTERN::matcher)\n            .filter(Matcher::matches)\n            .map(match -> new Version(Integer.parseInt(match.group(1)), Integer.parseInt(match.group(2)), Integer.parseInt(match.group(3))))\n            .sorted()\n            .toList();\n    }\n\n    private List<DevelopmentBranch> getDevelopmentBranches() {\n        String configuredBranchesFileLocation = project.getProviders()\n            .gradleProperty(BRANCHES_FILE_LOCATION_PROPERTY)\n            .getOrElse(DEFAULT_BRANCHES_FILE_URL);\n        String branchesFileLocation = configuredBranchesFileLocation;\n        if (project.getGradle().getStartParameter().isOffline() && isHttpLocation(configuredBranchesFileLocation)) {","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java#L185-L221","documentation":"Thrown by GlobalBuildInfoPlugin.resolveBwcVersions(Version) when reading the backwards-compatibility (BWC) versions source file fails with IOException. The file path is resolved from the BWC_VERSION_SOURCE system property or defaults to a Java file (DEFAULT_VERSION_JAVA_FILE_PATH) in the Elasticsearch workspace. The IOException is wrapped in IllegalStateException. Note: the error message contains a typo ('Unable to resolve to resolve').","triggerScenarios":"System.getProperty('BWC_VERSION_SOURCE') is set to a non-existent or unreadable file path, or the default path (Util.locateElasticsearchWorkspace + DEFAULT_VERSION_JAVA_FILE_PATH) cannot be read. The FileInputStream constructor or IOUtils.readLines throws IOException.","commonSituations":"BWC_VERSION_SOURCE is set to a stale path after a repository restructure. The workspace detection (Util.locateElasticsearchWorkspace) fails to find the Elasticsearch root, producing a path that doesn't exist. A composite build setup causes the workspace to be located differently. The default Version.java file was renamed or moved in a newer branch.","solutions":["If BWC_VERSION_SOURCE is set, verify the path exists and is readable: test -r $BWC_VERSION_SOURCE.","Unset BWC_VERSION_SOURCE to fall back to the default path in the workspace.","Verify Util.locateElasticsearchWorkspace resolves correctly by checking the Gradle project root matches the Elasticsearch repo root.","If the default Version.java path changed, update DEFAULT_VERSION_JAVA_FILE_PATH in the plugin source."],"exampleFix":"# before\n./gradlew build -DBWC_VERSION_SOURCE=/old/path/Version.java\n\n# after (valid path or unset)\n./gradlew build -DBWC_VERSION_SOURCE=/correct/path/to/Version.java\n# or simply omit to use default\n./gradlew build","handlingStrategy":"validation","validationCode":"// Validate BWC version source file before reading\nString path = System.getProperty(\"BWC_VERSION_SOURCE\");\nif (path != null) {\n    File f = new File(path);\n    if (!f.exists() || !f.canRead()) {\n        throw new GradleException(\"BWC_VERSION_SOURCE does not exist or is unreadable: \" + path);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["If setting BWC_VERSION_SOURCE, verify the path is readable before building.","Unset BWC_VERSION_SOURCE if the default workspace path should be used.","Keep Version.java at its expected location after repository restructuring."],"tags":["bwc","backwards-compatibility","versioning","filesystem","io"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}