{"record":{"id":"47d414ddebd16197","repo":"apache/cassandra","slug":"you-need-to-run-primary-range-repair-on-all-nodes","errorCode":null,"errorMessage":"You need to run primary range repair on all nodes in the cluster.","messagePattern":"You need to run primary range repair on all nodes in the cluster\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/repair/messages/RepairOption.java","lineNumber":291,"sourceCode":"            while (tokenizer.hasMoreTokens())\n            {\n                columnFamilies.add(tokenizer.nextToken().trim());\n            }\n            option.getColumnFamilies().addAll(columnFamilies);\n        }\n\n        // validate options\n        if (jobThreads > MAX_JOB_THREADS)\n        {\n            throw new IllegalArgumentException(\"Too many job threads. Max is \" + MAX_JOB_THREADS);\n        }\n        if (!dataCenters.isEmpty() && !hosts.isEmpty())\n        {\n            throw new IllegalArgumentException(\"Cannot combine -dc and -hosts options.\");\n        }\n        if (primaryRange && ((!dataCenters.isEmpty() && !option.isInLocalDCOnly()) || !hosts.isEmpty()))\n        {\n            throw new IllegalArgumentException(\"You need to run primary range repair on all nodes in the cluster.\");\n        }\n        if (pullRepair)\n        {\n            if (hosts.size() != 2)\n            {\n                throw new IllegalArgumentException(\"Pull repair can only be performed between two hosts. Please specify two hosts, one of which must be this host.\");\n            }\n            else if (ranges.isEmpty())\n            {\n                throw new IllegalArgumentException(\"Token ranges must be specified when performing pull repair. Please specify at least one token range which both hosts have in common.\");\n            }\n        }\n\n        return option;\n    }\n\n    private final RepairParallelism parallelism;\n    private final boolean primaryRange;","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/repair/messages/RepairOption.java#L273-L309","documentation":"RepairOption.parse enforces that primary-range repair cannot be scoped to a subset of nodes or (outside local-DC-only mode) a subset of datacenters. Primary range repair relies on every node owning its primary ranges, so restricting the node set would leave ranges unrepaired. IllegalArgumentException is thrown to prevent a partially-executed primary range repair.","triggerScenarios":"nodetool repair -pr -hosts h1,h2 ... or -pr with -dc when option.isInLocalDCOnly() is false.","commonSituations":"Operators assuming -pr can be combined with -hosts to repair 'just this node's primary range'; DC-scoped primary repairs attempted across multi-DC clusters without local-DC-only semantics.","solutions":["Run primary range repair without -hosts/-dc restrictions on every node of the cluster","Drop -pr and use a normal (sequential/parallel) repair with your scoping flags","If scope must be local, use the local-DC-only option so primary-range + -dc is accepted"],"exampleFix":"// before\nnodetool repair -pr -hosts 10.0.0.1 keyspace1\n// after\n# run on each node:\nnodetool repair -pr keyspace1","handlingStrategy":"validation","validationCode":"boolean primaryRange = opts.containsKey(\"primaryRange\");\nboolean scoped = nonEmpty(opts.get(\"hosts\")) || nonEmpty(opts.get(\"datacenters\"));\nif (primaryRange && scoped) throw new IllegalArgumentException(\"-pr cannot be combined with -hosts/-dc\");","typeGuard":null,"tryCatchPattern":"try { RepairOption.parse(opts); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"primary range repair on all nodes\")) { /* rerun unscoped on every node */ } else throw e; }","preventionTips":["Run -pr repairs as a cluster-wide loop (once per node, unscoped)","Use non-primary-range repair when you need node/DC scoping","Use local-DC-only mode if you must combine primary range with DC scoping"],"tags":["repair","cli","conflicting-options"],"backgroundTag":"conflicting-config-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"}