elastic/elasticsearch · error · IllegalArgumentException
Output file not specified
Error message
Output file not specified
What it means
Thrown by ExtractCurrentVersionsTask.executeTask when the --output-file option was not provided. The task collects version/tag information into a list and writes it to outputFile; with outputFile == null the write target is unknown and the task aborts before doing any extraction work.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/ExtractCurrentVersionsTask.java:50
public abstract class ExtractCurrentVersionsTask extends AbstractVersionsTask {
private static final Logger LOGGER = Logging.getLogger(ExtractCurrentVersionsTask.class);
private Path outputFile;
@Inject
public ExtractCurrentVersionsTask(BuildLayout layout) {
super(layout);
}
@Option(option = "output-file", description = "File to output tag information to")
public void outputFile(String file) {
this.outputFile = Path.of(file);
}
@TaskAction
public void executeTask() throws IOException {
if (outputFile == null) {
throw new IllegalArgumentException("Output file not specified");
}
LOGGER.lifecycle("Extracting latest version information");
List<String> output = new ArrayList<>();
int indexVersion = readLatestVersion(rootDir.resolve(INDEX_VERSIONS_FILE_PATH));
LOGGER.lifecycle("Index version: {}", indexVersion);
output.add(INDEX_VERSION_TYPE + ":" + indexVersion);
LOGGER.lifecycle("Writing version information to {}", outputFile);
Files.write(outputFile, output, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
}
static class FieldIdExtractor implements Consumer<FieldDeclaration> {
private Integer highestVersionId;
Integer highestVersionId() {View on GitHub (pinned to db6a809a66)
Solutions
- Add --output-file <path> to the invocation (e.g. ./gradlew extractCurrentVersions --output-file /tmp/versions.txt).
- Ensure the parent directory of the chosen output path exists/writable.
- Update release automation to always supply --output-file.
Example fix
// before ./gradlew extractCurrentVersions // after ./gradlew extractCurrentVersions --output-file build/versions.txt
Defensive patterns
Strategy: validation
Validate before calling
if (outputFile == null) {
throw new IllegalArgumentException("--output-file is required for extractCurrentVersions");
} Prevention
- Always pass --output-file in release automation scripts.
- Document required flags in the release runbook.
- Default the output path in wrapper scripts to avoid forgetting it.
When it happens
Trigger: Invoking extractCurrentVersions without --output-file. executeTask checks `if (outputFile == null)` immediately and throws IllegalArgumentException.
Common situations: Running the extraction task manually and forgetting the flag; a consuming release script changed and no longer passes --output-file; invoking via a wrapper that conditionally sets the output path.
Related errors
- Invalid tag format [{l}]
- 'branch' not specified.
- Cannot use a commit SHA ({branchRef}) as --branch when fetch
- No version ids found in {javaVersionsFile}
- Invalid version format: '{s}'. Should be {pattern}
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/8800dc965dcdb8b1.
Report an issue: GitHub.