{"record":{"id":"d707786103382e65","repo":"elastic/elasticsearch","slug":"downloading-s-from-dra-didn-t-produce-expected-ar","errorCode":null,"errorMessage":"Downloading %s from DRA didn't produce expected artifact [%s].","messagePattern":"Downloading (.+?) from DRA didn't produce expected artifact \\[(.+?)\\]\\.","errorType":"exception","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java","lineNumber":657,"sourceCode":"                            bwcVersion.get(),\n                            projectName,\n                            buildId\n                        )\n                );\n                t.from(draConfig);\n                t.getInputs().property(\"draBuildId\", buildId);\n                if (useNativeExpanded) {\n                    t.into(projectArtifact.expandedDistDir);\n                    t.getOutputs().dir(expectedOutputFile);\n                } else {\n                    t.into(projectArtifact.distFile.getParentFile());\n                    t.getOutputs().files(projectArtifact.distFile);\n                }\n                t.getOutputs().doNotCacheIf(\"BWC distribution caching is disabled for local builds\", task -> buildParams.getCi() == false);\n                t.doLast(task -> {\n                    if (expectedOutputFile.exists() == false) {\n                        Path relativeOutputPath = rootDir.toPath().relativize(expectedOutputFile.toPath());\n                        throw new InvalidUserDataException(\n                            \"Downloading %s from DRA didn't produce expected artifact [%s].\".formatted(bwcVersion.get(), relativeOutputPath)\n                        );\n                    }\n                });\n            });\n        }\n        bwcTaskProvider.configure(t -> t.dependsOn(bwcTaskName));\n    }\n\n    /**\n     * Validates the {@code tests.bwc.mode} value, throwing {@link InvalidUserDataException} for\n     * unrecognised values so users get a clear error message rather than a silent no-op.\n     */\n    static void validateBwcMode(String mode) {\n        if (Set.of(\"gradle\", \"dra\", \"auto\").contains(mode) == false) {\n            throw new InvalidUserDataException(\"Invalid tests.bwc.mode value [\" + mode + \"]. Must be one of: gradle, dra, auto\");\n        }\n    }","sourceCodeStart":639,"sourceCodeEnd":675,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java#L639-L675","documentation":"Thrown as InvalidUserDataException in createDraBwcTask's Copy task doLast when expectedOutputFile doesn't exist after downloading the BWC distribution from the DRA (Distributed Release Archive) Ivy repository. Unlike the gradle-build path, this fires when a DRA snapshot was selected but the download/transform didn't land the expected file — the snapshot is incomplete or the artifact transform failed.","triggerScenarios":"In the Copy task registered at line 634 (distribution archives path), t.from(draConfig) resolves the dependency from the DRA Ivy repo, then doLast at line 654 checks expectedOutputFile.exists(). If the DRA snapshot lacks the matching artifact (wrong buildId, version, classifier, or extension), the copy produces nothing and the check throws.","commonSituations":"The DRA buildId points to a snapshot that didn't include this platform's archive (e.g., windows-zip missing from a linux-only build); the version string mismatch (bwcVersion-SNAPSHOT doesn't match what's published); the Ivy patternLayout doesn't match the DRA's actual path layout; network/proxy issue silently failed the download.","solutions":["Verify the DRA buildId is correct and that the snapshot actually contains the expected artifact — browse the DRA endpoint at /elasticsearch/<buildId>/downloads/elasticsearch/.","Check the patternLayout in the Ivy repo config matches the DRA's actual path structure for this version/classifier/extension.","Confirm network connectivity to the DRA base URL; re-run with --info to see the resolution attempts.","If the DRA snapshot is genuinely incomplete, fall back to gradle mode: -Dtests.bwc.mode=gradle."],"exampleFix":"# before: DRA buildId lacks the windows-zip artifact\n-Dtests.bwc.mode=dra -Dtests.bwc.distro.build_id=<incomplete-build>\n\n# after: use a complete DRA build or fall back to source build\n-Dtests.bwc.mode=auto  # auto-falls back to gradle if DRA artifact missing","handlingStrategy":"validation","validationCode":"// verify DRA artifact exists before relying on the download\nString url = draBaseUrl + \"/elasticsearch/\" + buildId + \"/downloads/elasticsearch/\";\nHttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();\nif (conn.getResponseCode() != 200) {\n    System.err.println(\"DRA listing unreachable; consider tests.bwc.mode=gradle\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use tests.bwc.mode=auto so a missing DRA artifact falls back to gradle source build.","Verify the DRA buildId includes the target platform's archive before pinning it.","Check DRA endpoint reachability and proxy settings on CI.","Confirm the Ivy patternLayout matches the DRA's actual path structure."],"tags":["bwc","dra","distribution","download","gradle"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}