{"record":{"id":"e4ff7cb79050526e","repo":"apache/cassandra","slug":"cannot-specify-both-sai-only-and-include-sai","errorCode":null,"errorMessage":"Cannot specify both --sai-only and --include-sai","messagePattern":"Cannot specify both --sai-only and --include-sai","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/Verify.java","lineNumber":104,"sourceCode":"\n    @Option(paramLabel = \"include_sai\",\n            names = { \"-i\", \"--include-sai\"},\n            description = \"Include SAI index verification along with data files\")\n    private boolean includeSai = false;\n\n    @Override\n    public void execute(NodeProbe probe)\n    {\n        args = concatArgs(keyspace, tables);\n        PrintStream out = probe.output().out;\n        if (!overrideDisable)\n        {\n            out.println(\"verify is disabled unless a [-f|--force] override flag is provided. See CASSANDRA-9947 and CASSANDRA-17017 for details.\");\n            System.exit(1);\n        }\n\n        if (onlySai && includeSai)\n            throw new IllegalArgumentException(\"Cannot specify both --sai-only and --include-sai\");\n\n        List<String> keyspaces = parseOptionalKeyspace(args, probe);\n        String[] tableNames = parseOptionalTables(args);\n\n        if (checkOwnsTokens && !extendedVerify)\n        {\n            out.println(\"Token verification requires --extended-verify\");\n            // if System.exit gets removed, make sure to update org.apache.cassandra.distributed.test.NodeToolTest.testNodetoolSystemExit\n            System.exit(1);\n        }\n\n        for (String keyspace : keyspaces)\n        {\n            try\n            {\n                probe.verify(out, extendedVerify, checkVersion, diskFailurePolicy, mutateRepairStatus, checkOwnsTokens, quick, onlySai, includeSai, keyspace, tableNames);\n            } catch (Exception e)\n            {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/Verify.java#L86-L122","documentation":"nodetool verify supports two mutually exclusive SAI-related flags: --sai-only (verify only SAI indexes) and --include-sai (verify non-SAI plus SAI). Passing both is ambiguous, so execute() throws IllegalArgumentException before starting verification. No verification runs.","triggerScenarios":"`nodetool verify --sai-only --include-sai <keyspace> <table>` in a single invocation.","commonSituations":"Scripts accumulating flags from merged examples; users unsure which flag they need and passing both to be safe; templated commands where both options were parameterized to true.","solutions":["Pass only one flag: --sai-only to verify just SAI indexes, --include-sai to add SAI to the normal verify scope.","Remove both flags for the default (non-SAI) verify behavior.","Fix the calling script/template so the two options cannot both resolve to true."],"exampleFix":"// before\nnodetool verify --sai-only --include-sai myks mytable\n// after\nnodetool verify --include-sai myks mytable","handlingStrategy":"validation","validationCode":"if (saiOnly && includeSai)\n    throw new IllegalArgumentException(\"--sai-only and --include-sai are mutually exclusive\");","typeGuard":null,"tryCatchPattern":"try { runVerify(args); }\ncatch (IllegalArgumentException e) { if (e.getMessage().contains(\"--sai-only and --include-sai\")) { /* fix flags and retry */ } else throw e; }","preventionTips":["Model the options as an enum (SAI_ONLY | INCLUDE_SAI | NONE) in wrapper tooling so both cannot be set.","Review generated command lines for duplicate/overlapping flags.","Document flag semantics for operators: --sai-only excludes non-SAI work, --include-sai extends the default scope."],"tags":["nodetool","cli","flags"],"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"}