elastic/elasticsearch · error · InvalidUserDataException

Downloading %s from DRA didn't produce expected artifact [%s

Error message

Downloading %s from DRA didn't produce expected artifact [%s].

What it means

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.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java:657

                            bwcVersion.get(),
                            projectName,
                            buildId
                        )
                );
                t.from(draConfig);
                t.getInputs().property("draBuildId", buildId);
                if (useNativeExpanded) {
                    t.into(projectArtifact.expandedDistDir);
                    t.getOutputs().dir(expectedOutputFile);
                } else {
                    t.into(projectArtifact.distFile.getParentFile());
                    t.getOutputs().files(projectArtifact.distFile);
                }
                t.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> buildParams.getCi() == false);
                t.doLast(task -> {
                    if (expectedOutputFile.exists() == false) {
                        Path relativeOutputPath = rootDir.toPath().relativize(expectedOutputFile.toPath());
                        throw new InvalidUserDataException(
                            "Downloading %s from DRA didn't produce expected artifact [%s].".formatted(bwcVersion.get(), relativeOutputPath)
                        );
                    }
                });
            });
        }
        bwcTaskProvider.configure(t -> t.dependsOn(bwcTaskName));
    }

    /**
     * Validates the {@code tests.bwc.mode} value, throwing {@link InvalidUserDataException} for
     * unrecognised values so users get a clear error message rather than a silent no-op.
     */
    static void validateBwcMode(String mode) {
        if (Set.of("gradle", "dra", "auto").contains(mode) == false) {
            throw new InvalidUserDataException("Invalid tests.bwc.mode value [" + mode + "]. Must be one of: gradle, dra, auto");
        }
    }

View on GitHub (pinned to db6a809a66)

Solutions

  1. Verify the DRA buildId is correct and that the snapshot actually contains the expected artifact — browse the DRA endpoint at /elasticsearch/<buildId>/downloads/elasticsearch/.
  2. Check the patternLayout in the Ivy repo config matches the DRA's actual path structure for this version/classifier/extension.
  3. Confirm network connectivity to the DRA base URL; re-run with --info to see the resolution attempts.
  4. If the DRA snapshot is genuinely incomplete, fall back to gradle mode: -Dtests.bwc.mode=gradle.

Example fix

# before: DRA buildId lacks the windows-zip artifact
-Dtests.bwc.mode=dra -Dtests.bwc.distro.build_id=<incomplete-build>

# after: use a complete DRA build or fall back to source build
-Dtests.bwc.mode=auto  # auto-falls back to gradle if DRA artifact missing
Defensive patterns

Strategy: validation

Validate before calling

// verify DRA artifact exists before relying on the download
String url = draBaseUrl + "/elasticsearch/" + buildId + "/downloads/elasticsearch/";
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
if (conn.getResponseCode() != 200) {
    System.err.println("DRA listing unreachable; consider tests.bwc.mode=gradle");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/d707786103382e65. Report an issue: GitHub.