{"record":{"id":"6440be7120402b27","repo":"elastic/elasticsearch","slug":"at-least-one-of-add-branch-remove-branch-or-updat","errorCode":null,"errorMessage":"At least one of add-branch, remove-branch or update-branch must be specified","messagePattern":"At least one of add-branch, remove-branch or update-branch must be specified","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/UpdateBranchesJsonTask.java","lineNumber":121,"sourceCode":"    @Option(option = \"update-branch\", description = \"Specifies the branch and corresponding version to update in format <branch>:<version>\")\n    public void updateBranch(String branchAndVersion) {\n        this.updateBranch = toDevelopmentBranch(branchAndVersion);\n    }\n\n    private DevelopmentBranch toDevelopmentBranch(String branchAndVersion) {\n        String[] parts = branchAndVersion.split(\":\");\n        if (parts.length != 2) {\n            throw new InvalidUserDataException(\"Expected branch and version in format <branch>:<version>\");\n        }\n        return new DevelopmentBranch(parts[0], Version.fromString(parts[1]));\n    }\n\n    @TaskAction\n    public void executeTask() throws IOException {\n        List<DevelopmentBranch> developmentBranches = readBranches(branchesFile);\n\n        if (addBranch == null && removeBranch == null && updateBranch == null) {\n            throw new InvalidUserDataException(\"At least one of add-branch, remove-branch or update-branch must be specified\");\n        }\n\n        if (addBranch != null) {\n            LOGGER.info(\"Adding branch {} with version {}\", addBranch.name(), addBranch.version());\n            if (developmentBranches.stream().anyMatch(developmentBranch -> developmentBranch.name().equals(addBranch.name()))) {\n                throw new InvalidUserDataException(\"Branch \" + addBranch.name() + \" already exists\");\n            }\n            developmentBranches.add(addBranch);\n        }\n        if (removeBranch != null) {\n            LOGGER.info(\"Removing branch {}\", removeBranch);\n            if (developmentBranches.stream().noneMatch(developmentBranch -> developmentBranch.name().equals(removeBranch))) {\n                throw new InvalidUserDataException(\"Branch \" + removeBranch + \" does not exist\");\n            }\n            developmentBranches.removeIf(developmentBranch -> developmentBranch.name().equals(removeBranch));\n        }\n        if (updateBranch != null) {\n            LOGGER.info(\"Updating branch {} with version {}\", updateBranch.name(), updateBranch.version());","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/UpdateBranchesJsonTask.java#L103-L139","documentation":"Thrown by UpdateBranchesJsonTask.executeTask() when none of addBranch, removeBranch, or updateBranch has been set. The task is a no-op without at least one operation, so it refuses to run.","triggerScenarios":"Invoking updateBranches without any of --add-branch, --remove-branch, or --update-branch.","commonSituations":"A release script conditionally builds the option list and supplied none; the options were renamed or mis-flagged.","solutions":["Provide at least one of --add-branch=<branch>:<version>, --remove-branch=<branch>, or --update-branch=<branch>:<version>.","Audit the release script to confirm the conditional that supplies these options is reachable."],"exampleFix":"// before\n./gradlew updateBranches\n\n// after\n./gradlew updateBranches --add-branch=8.11:8.11.0","handlingStrategy":"validation","validationCode":"// Fail early if no operation flag is present\ntasks.named('updateBranches').configure(t -> t.doFirst(spec -> {\n    var p = spec.getProviders();\n    if (p.gradleProperty(\"add-branch\").forUseAtConfigurationTime().isPresent()\n        || p.gradleProperty(\"remove-branch\").forUseAtConfigurationTime().isPresent()\n        || p.gradleProperty(\"update-branch\").forUseAtConfigurationTime().isPresent()) {\n        return;\n    }\n    throw new GradleException(\"At least one of --add-branch, --remove-branch, --update-branch is required\");\n}));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap the updateBranches invocation in a script that asserts at least one flag was passed."],"tags":["release-tooling","gradle-task","missing-option","precondition"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}