{"record":{"id":"0357ab013b28fab3","repo":"apache/cassandra","slug":"only-one-of-node-or-ip-need-to-be-set","errorCode":null,"errorMessage":"Only one of --node or --ip need to be set","messagePattern":"Only one of --node or --ip need to be set","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/AbortBootstrap.java","lineNumber":43,"sourceCode":"import static org.apache.commons.lang3.StringUtils.EMPTY;\nimport static org.apache.commons.lang3.StringUtils.isEmpty;\n\n@Command(name = \"abortbootstrap\", description = \"Abort a failed bootstrap\")\npublic class AbortBootstrap extends AbstractCommand\n{\n    @Option(paramLabel = \"node_id\", names = \"--node\", description = \"Node ID of the node that failed bootstrap\")\n    private String nodeId = EMPTY;\n\n    @Option(paramLabel = \"ip\", names = \"--ip\", description = \"IP of the node that failed bootstrap\")\n    private String endpoint = EMPTY;\n\n    @Override\n    public void execute(NodeProbe probe)\n    {\n        if (isEmpty(nodeId) && isEmpty(endpoint))\n            throw new IllegalArgumentException(\"Either --node or --ip needs to be set\");\n        if (!isEmpty(nodeId) && !isEmpty(endpoint))\n            throw new IllegalArgumentException(\"Only one of --node or --ip need to be set\");\n        probe.abortBootstrap(nodeId, endpoint);\n    }\n}\n","sourceCodeStart":25,"sourceCodeEnd":47,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/AbortBootstrap.java#L25-L47","documentation":"The mirror case of missing-required-option: nodetool abortbootstrap throws IllegalArgumentException when BOTH --node and --ip are supplied, since exactly one way to identify the bootstrap must be given.","triggerScenarios":"Running 'nodetool abortbootstrap --node <id> --ip <addr>' — both non-empty — from the shell or a script that always appends both flags.","commonSituations":"Template scripts that set both variables unconditionally; copy-pasting example commands containing both flags; operator unsure which identifier to use and passing both.","solutions":["Remove one of the two flags so only --node or only --ip is present","If unsure of the host id, look it up with nodetool status and use just --ip, or vice versa","Fix scripts so they pass one identifier chosen programmatically, not both"],"exampleFix":"// before\nnodetool abortbootstrap --node 5f4a --ip 10.0.0.5:7000\n// after\nnodetool abortbootstrap --ip 10.0.0.5:7000","handlingStrategy":"validation","validationCode":"boolean hasNode = nodeId != null && !nodeId.isEmpty();\nboolean hasIp = endpoint != null && !endpoint.isEmpty();\nif (hasNode && hasIp)\n    throw new IllegalArgumentException(\"Pass only one of --node or --ip\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose one identifier (host id or ip) per invocation","Build scripts that pass exactly one flag","Read the tool's usage before combining flags"],"tags":["nodetool","cli","bootstrap"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}