elastic/elasticsearch · error · InvalidUserDataException
Building %s didn't generate expected artifact [%s]. The work
Error message
Building %s didn't generate expected artifact [%s]. The working branch may be out-of-date - try merging in the latest upstream changes to the branch.
What it means
Thrown as InvalidUserDataException in the gradle-build BWC task's doLast when the expected output artifact (expectedOutputFile) doesn't exist after running the assemble task in the BWC checkout. The gradle-mode BWC path builds the previous version from source; if the build succeeded but didn't produce the expected archive name, the branch is likely out-of-date or the assemble task name is wrong.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java:535
} else {
c.getOutputs().files(expectedOutputFile);
}
c.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> buildParams.getCi() == false);
c.getArgs().add("-p");
c.getArgs().add(projectPath);
c.getArgs().add(assembleTaskName);
if (project.getGradle().getStartParameter().isBuildCacheEnabled()) {
c.getArgs().add("--build-cache");
}
File rootDir = project.getLayout().getSettingsDirectory().getAsFile();
c.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
if (expectedOutputFile.exists() == false) {
Path relativeOutputPath = rootDir.toPath().relativize(expectedOutputFile.toPath());
final String message = "Building %s didn't generate expected artifact [%s]. The working branch may be "
+ "out-of-date - try merging in the latest upstream changes to the branch.";
throw new InvalidUserDataException(message.formatted(bwcVersion.get(), relativeOutputPath));
}
}
});
});
bwcTaskProvider.configure(t -> t.dependsOn(bwcTaskName));
}
}
private static void createDraBwcTask(
Project project,
String bwcTaskName,
String buildId,
String draBaseUrl,
Provider<Version> bwcVersion,
String projectName,
DistributionProjectArtifact projectArtifact,
String gradleClassifier,
String extension,View on GitHub (pinned to db6a809a66)
Solutions
- Merge the latest upstream changes into the BWC branch and re-run — the message itself suggests this.
- Verify the assembleTaskName exists in the BWC branch's build (e.g., ':distribution:archives:linux-tar:assemble' is valid for that version).
- Check that expectedOutputFile's name matches what the BWC branch actually produces (version string, classifier, extension).
- Run the BWC build manually in the checkout dir to see what artifact it generates: cd <checkout> && ./gradlew <assembleTaskName> and inspect build/distributions/.
Example fix
# before: BWC branch lacks the new archive name # throws: Building 8.x didn't generate expected artifact [...] git -C distribution/bwc/<ver> merge upstream/main ./gradlew bwcTest
Defensive patterns
Strategy: validation
Validate before calling
if (expectedOutputFile.exists() == false) {
// before throwing, check if the assemble task name is valid for this branch
System.err.println("Expected artifact missing: " + expectedOutputFile);
System.err.println("Verify assemble task '" + assembleTaskName + "' exists in BWC branch");
} Prevention
- Keep BWC branches merged with upstream to pick up artifact naming changes.
- Verify the assemble task name exists in the BWC branch before relying on it.
- Run the BWC build manually in the checkout to confirm expected output.
- Use tests.bwc.mode=auto to fall back to DRA if gradle build fails.
When it happens
Trigger: In the bwcSetupExtension.bwcTask configuration (line 505), after the forked Gradle build runs '-p <projectPath> <assembleTaskName>', the doLast at line 528 checks expectedOutputFile.exists(). If false, it formats the message with bwcVersion and the root-relative path and throws. Triggered when the BWC branch's build.gradle produces a differently-named artifact or the branch lacks the assemble task.
Common situations: The BWC branch hasn't been merged with the latest upstream changes that renamed/added the distribution artifact; the bwcVersion's checkout is stale; the assemble task name doesn't exist in that branch's build; expectedOutputFile path computed from current project layout doesn't match the older branch's output structure.
Related errors
- Downloading %s from DRA didn't produce expected artifact [%s
- Configuring a snapshot bwc distribution ('${distribution.get
- Cannot set Elasticsearch Distribution type to ${type}. Type
- distribution type [${typeName}] for elasticsearch distributi
- platform cannot be set on elasticsearch distribution [${name
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/b869400a3cfd0c24.
Report an issue: GitHub.