{"record":{"id":"8800dc965dcdb8b1","repo":"elastic/elasticsearch","slug":"output-file-not-specified","errorCode":null,"errorMessage":"Output file not specified","messagePattern":"Output file not specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/ExtractCurrentVersionsTask.java","lineNumber":50,"sourceCode":"public abstract class ExtractCurrentVersionsTask extends AbstractVersionsTask {\n    private static final Logger LOGGER = Logging.getLogger(ExtractCurrentVersionsTask.class);\n\n    private Path outputFile;\n\n    @Inject\n    public ExtractCurrentVersionsTask(BuildLayout layout) {\n        super(layout);\n    }\n\n    @Option(option = \"output-file\", description = \"File to output tag information to\")\n    public void outputFile(String file) {\n        this.outputFile = Path.of(file);\n    }\n\n    @TaskAction\n    public void executeTask() throws IOException {\n        if (outputFile == null) {\n            throw new IllegalArgumentException(\"Output file not specified\");\n        }\n\n        LOGGER.lifecycle(\"Extracting latest version information\");\n\n        List<String> output = new ArrayList<>();\n\n        int indexVersion = readLatestVersion(rootDir.resolve(INDEX_VERSIONS_FILE_PATH));\n        LOGGER.lifecycle(\"Index version: {}\", indexVersion);\n        output.add(INDEX_VERSION_TYPE + \":\" + indexVersion);\n\n        LOGGER.lifecycle(\"Writing version information to {}\", outputFile);\n        Files.write(outputFile, output, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);\n    }\n\n    static class FieldIdExtractor implements Consumer<FieldDeclaration> {\n        private Integer highestVersionId;\n\n        Integer highestVersionId() {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/ExtractCurrentVersionsTask.java#L32-L68","documentation":"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.","triggerScenarios":"Invoking extractCurrentVersions without --output-file. executeTask checks `if (outputFile == null)` immediately and throws IllegalArgumentException.","commonSituations":"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.","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."],"exampleFix":"// before\n./gradlew extractCurrentVersions\n// after\n./gradlew extractCurrentVersions --output-file build/versions.txt","handlingStrategy":"validation","validationCode":"if (outputFile == null) {\n    throw new IllegalArgumentException(\"--output-file is required for extractCurrentVersions\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["build","gradle","release","versioning","cli-args"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T11:17:21.771Z"}