elastic/elasticsearch · error · GradleException
Expecting project name containing 'zip' or 'tar'.
Error message
Expecting project name containing 'zip' or 'tar'.
What it means
Thrown as GradleException by calculateArchiveExtractionDir() when the project name contains neither 'tar' nor 'zip'. The plugin is applied per-distribution-archive project and decides the extraction directory by substring-matching the project name; an unexpected project name indicates the plugin was applied to the wrong project or a project was renamed.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java:96
.add(
"projectLicenses",
Map.of("Elastic License 2.0", project.getExtensions().getExtraProperties().get("elasticLicenseUrl"))
);
TaskProvider<Task> checkMlCppNoticeTask = registerCheckMlCppNoticeTask(
project,
checkExtraction,
distributionArchiveCheckExtension
);
checkTask.configure(task -> task.dependsOn(checkMlCppNoticeTask));
}
}
private File calculateArchiveExtractionDir(Project project) {
if (project.getName().contains("tar")) {
return new File(project.getBuildDir(), "tar-extracted");
}
if (project.getName().contains("zip") == false) {
throw new GradleException("Expecting project name containing 'zip' or 'tar'.");
}
return new File(project.getBuildDir(), "zip-extracted");
}
private static TaskProvider<Task> registerCheckMlCppNoticeTask(
Project project,
TaskProvider<Copy> checkExtraction,
DistributionArchiveCheckExtension extension
) {
TaskProvider<Task> checkMlCppNoticeTask = project.getTasks().register("checkMlCppNotice", task -> {
task.dependsOn(checkExtraction);
final Provider<Path> noticePath = checkExtraction.map(
c -> c.getDestinationDir()
.toPath()
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt")
);
ListProperty<String> expectedMlLicenses = extension.expectedMlLicenses;
task.doLast(new Action<Task>() {View on GitHub (pinned to db6a809a66)
Solutions
- Verify the project applying this plugin is a distribution archive project named with a 'zip' or 'tar' suffix.
- Rename the project to follow the convention (e.g., elasticsearch-windows-zip, elasticsearch-linux-tar).
- If the plugin was applied erroneously, remove the `apply plugin: 'elasticsearch.internal-distribution-archive-check'` line.
Example fix
// before: project named 'dist-default' → throws
evaluationDependsOn(':distribution:archives:dist-default')
// after: project named with -zip suffix
include ':distribution:archives:default-zip' Defensive patterns
Strategy: validation
Validate before calling
String name = project.getName();
if (name.contains("zip") == false && name.contains("tar") == false) {
throw new IllegalStateException("Plugin requires project name containing 'zip' or 'tar': " + name);
} Prevention
- Only apply elasticsearch.internal-distribution-archive-check to archive projects named with -zip or -tar suffix.
- Follow the :distribution:archives:<platform>-<format> naming convention.
- Add a project naming test in settings.gradle validation.
When it happens
Trigger: calculateArchiveExtractionDir (line 91) is called once during apply(). If project.getName() lacks both 'tar' and 'zip' — e.g., a project mistakenly applying InternalDistributionArchiveCheckPlugin, or a renamed distribution project — the second if throws.
Common situations: A new subproject under :distribution:archives with a name not following the '-zip'/'-tar' convention; someone applied the plugin in a custom build script to a non-archive project; refactoring renamed a project and broke the naming contract.
Related errors
- Cannot set Elasticsearch Distribution type to ${type}. Type
- distribution type [${typeName}] for elasticsearch distributi
- platform cannot be set on elasticsearch distribution [${name
- bundledJdk cannot be set on elasticsearch distribution [${na
- failIfUnavailable cannot be 'false' on elasticsearch distrib
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/204382ab5f5cab3d.
Report an issue: GitHub.