{"record":{"id":"0f588c63c70280d3","repo":"apache/cassandra","slug":"invalid-option-combination-can-not-use-split-outp","errorCode":null,"errorMessage":"Invalid option combination: Can not use split-output here","messagePattern":"Invalid option combination: Can not use split-output here","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/Compact.java","lineNumber":74,"sourceCode":"    @Option(paramLabel = \"partition_key\", names = { \"--partition\" }, description = \"String representation of the partition key\")\n    private String partitionKey = EMPTY;\n\n    @Option(paramLabel = \"jobs\",\n            names = {\"-j\", \"--jobs\"},\n            description = \"Use -j to specify the maximum number of threads to use for parallel compaction. \" +\n                          \"If not set, up to half the compaction threads will be used. \" +\n                          \"If set to 0, the major compaction will use all threads and will not permit other compactions to run until it completes (use with caution).\")\n    private Integer parallelism = null;\n\n    @Override\n    public void execute(NodeProbe probe)\n    {\n        final boolean startEndTokenProvided = !(startToken.isEmpty() && endToken.isEmpty());\n        final boolean partitionKeyProvided = !partitionKey.isEmpty();\n        final boolean tokenProvided = startEndTokenProvided || partitionKeyProvided;\n        if (splitOutput && (userDefined || tokenProvided))\n        {\n            throw new RuntimeException(\"Invalid option combination: Can not use split-output here\");\n        }\n        if (userDefined && tokenProvided)\n        {\n            throw new RuntimeException(\"Invalid option combination: Can not provide tokens when using user-defined\");\n        }\n\n        if (userDefined)\n        {\n            try\n            {\n                String userDefinedFiles = String.join(\",\", args);\n                probe.forceUserDefinedCompaction(userDefinedFiles);\n            } catch (Exception e) {\n                throw new RuntimeException(\"Error occurred during user defined compaction\", e);\n            }\n            return;\n        }\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/Compact.java#L56-L92","documentation":"Nodetool Compact rejects mutually exclusive options: --split-output cannot be combined with user-defined compaction (files listed as arguments) or token/partition-key ranged compaction. The command throws RuntimeException before contacting the node.","triggerScenarios":"Running `nodetool compact --split-output` together with `--user-defined`, `--start-token`/`--end-token`, or `--partition-key`.","commonSituations":"Scripting a compaction command and stacking flags without understanding that split-output only applies to ordinary keyspace/table compaction.","solutions":["Remove --split-output when doing user-defined or token/partition-key compaction.","Or drop the --user-defined / token arguments if split-output compaction of keyspaces was intended.","Re-run the command with a single compaction mode."],"exampleFix":"// before\nnodetool compact --split-output --start-token -100 --end-token 100 ks\n// after\nnodetool compact --start-token -100 --end-token 100 ks","handlingStrategy":"validation","validationCode":"boolean tokenProvided = !(startToken.isEmpty() && endToken.isEmpty()) || !partitionKey.isEmpty();\nif (splitOutput && (userDefined || tokenProvided))\n    throw new IllegalArgumentException(\"--split-output cannot be combined with --user-defined or tokens\");","typeGuard":null,"tryCatchPattern":"try { executeCompaction(...); }\ncatch (RuntimeException e) { if (e.getMessage().startsWith(\"Invalid option combination\")) { printUsage(); System.exit(2); } throw e; }","preventionTips":["Encode flag-compatibility rules in any wrapper scripts around nodetool compact.","Treat --split-output as keyspace-level compaction only.","Review `nodetool help compact` before composing multi-flag invocations.","Unit-test wrapper CLIs for mutually exclusive flag pairs."],"tags":["nodetool","cli","compaction","options"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}