elastic/elasticsearch · error · IllegalArgumentException
Release version not specified
Error message
Release version not specified
What it means
Thrown by TagVersionsTask.executeTask() when releaseVersion is still null — i.e. the @Option(option="release") setter was never invoked with a version string before the task ran. The task cannot proceed because every subsequent step keys off the release version.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/TagVersionsTask.java:57
@Inject
public TagVersionsTask(BuildLayout layout) {
super(layout);
}
@Option(option = "release", description = "The release version to be tagged")
public void release(String version) {
releaseVersion = Version.fromString(version);
}
@Option(option = "tag-version", description = "Version id to tag. Of the form <VersionType>:<id>.")
public void tagVersions(List<String> version) {
this.tagVersions = splitVersionIds(version);
}
@TaskAction
public void executeTask() throws IOException {
if (releaseVersion == null) {
throw new IllegalArgumentException("Release version not specified");
}
if (tagVersions.isEmpty()) {
throw new IllegalArgumentException("No version tags specified");
}
LOGGER.lifecycle("Tagging version {} component ids", releaseVersion);
var versions = expandV7Version(tagVersions);
for (var v : versions.entrySet()) {
Path recordFile = switch (v.getKey()) {
case INDEX_VERSION_TYPE -> rootDir.resolve(INDEX_VERSIONS_RECORD);
default -> throw new IllegalArgumentException("Unknown version type " + v.getKey());
};
LOGGER.lifecycle("Adding version record for {} to [{}]: [{},{}]", v.getKey(), recordFile, releaseVersion, v.getValue());
Path file = rootDir.resolve(recordFile);View on GitHub (pinned to db6a809a66)
Solutions
- Invoke the task with the --release option, e.g. ./gradlew tagVersions --release=8.10.0.
- If driving the task programmatically, call task.release(version) before task.executeTask().
- Add a Gradle DSL check (doFirst or @Input) that fails earlier with a clearer message when --release is absent.
Example fix
// before ./gradlew tagVersions --tag-version=Index:42 // after ./gradlew tagVersions --release=8.10.0 --tag-version=Index:42
Defensive patterns
Strategy: validation
Validate before calling
// In a Gradle doFirst on the tagVersions task
tasks.named('tagVersions').configure(t -> t.doFirst(spec -> {
TagVersionsTask task = (TagVersionsTask) spec.getTask();
if (!task.getProviders().gradleProperty("release").isPresent()) {
throw new GradleException("--release=<version> is required");
}
})); Prevention
- Make --release a documented, mandatory argument in the release runbook.
- Add a doFirst guard so failures surface before the task body runs.
When it happens
Trigger: Running the tagVersions task without passing --release=<version> on the Gradle command line, or with an empty value, or invoking executeTask() programmatically without first calling release(String).
Common situations: A release runbook step that supplies --release was skipped or refactored away; the property was renamed; CI invoked the task without the expected -P/-- options.
Related errors
- No version tags specified
- At least one of add-branch, remove-branch or update-branch m
- No versions to add or remove specified
- Unknown version type {key}
- Expected branch and version in format <branch>:<version>
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/2a18e644e056bda9.
Report an issue: GitHub.