{"record":{"id":"ce3d28a6d52dd1b3","repo":"elastic/elasticsearch","slug":"branch-not-specified","errorCode":null,"errorMessage":"'branch' not specified.","messagePattern":"'branch' not specified\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/BundleChangelogsTask.java","lineNumber":139,"sourceCode":"\n    /*\n        Given a branch, and possibly a build candidate commit sha\n        Check out the changelog yaml files from the branch/BC sha\n        Then, bundle them all up into one file and write it to disk, along with a timestamp and whether the release is considered released\n\n         When using a branch without a BC sha:\n            - Check out the changelog yaml files from the HEAD of the branch\n\n         When using a BC sha:\n            - Check out the changelog yaml files from the BC commit\n            - Update those files with any updates from the HEAD of the branch (in case the changelogs get modified later)\n            - Check for any changelog yaml files that were added AFTER the BC,\n              but whose PR was merged before the BC (in case someone adds a forgotten changelog after the fact)\n    */\n    @TaskAction\n    public void executeTask() throws IOException {\n        if (branch == null) {\n            throw new IllegalArgumentException(\"'branch' not specified.\");\n        }\n\n        final String upstreamRemote = gitWrapper.getUpstream();\n        final String esBcRefForGit = (bcRef != null && bcRef.isBlank() == false) ? resolveElasticsearchGitRef(bcRef, upstreamRemote) : null;\n        Set<String> entriesFromBc = Set.of();\n\n        var didCheckoutChangelogs = false;\n        try {\n            var usingBcRef = bcRef != null && bcRef.isBlank() == false;\n            if (usingBcRef) {\n                // Check out all the changelogs that existed at the time of the BC\n                checkoutChangelogs(gitWrapper, upstreamRemote, bcRef);\n                entriesFromBc = changelogDirectory.getAsFileTree().getFiles().stream().map(File::getName).collect(Collectors.toSet());\n\n                // Then add/update changelogs from the HEAD of the branch\n                // We do an \"add\" here, rather than checking out the entire directory, in case changelogs have been removed for some reason\n                addChangelogsFromRef(gitWrapper, upstreamRemote, branch);\n            } else {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/BundleChangelogsTask.java#L121-L157","documentation":"Thrown by BundleChangelogsTask.executeTask when the --branch option was not supplied. The bundling logic needs a target branch (and optionally a --bc-ref) to know which changelog YAML files to collect; with branch == null the task cannot proceed and aborts immediately.","triggerScenarios":"Invoking the bundleChangelogs task without the --branch command-line option. The task's executeTask checks `if (branch == null)` first thing and throws IllegalArgumentException before doing any git work.","commonSituations":"Running the release changelog-bundling Gradle task manually and forgetting --branch; a release script changed and dropped the flag; invoking via a wrapper that conditionally passes --branch only on some branches and ran on one without it.","solutions":["Add --branch <branchName> to the task invocation (e.g. ./gradlew bundleChangelogs --branch 8.x).","If a build candidate ref is intended, also pass --bc-ref <sha> (optional, but --branch is always required).","Update any release automation script to always supply --branch."],"exampleFix":"// before\n./gradlew bundleChangelogs\n// after\n./gradlew bundleChangelogs --branch 8.x","handlingStrategy":"validation","validationCode":"if (branch == null || branch.isBlank()) {\n    throw new IllegalArgumentException(\"--branch is required for bundleChangelogs\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap the task invocation in a script that always supplies --branch.","Document the required flags in the release runbook.","Fail fast in release automation with a clear message if --branch is missing."],"tags":["build","gradle","release","changelog","cli-args"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}