apache/cassandra · error · RuntimeException

Primary range repair should be performed on all nodes in…

Error message

Primary range repair should be performed on all nodes in the cluster.

What it means

Nodetool 'repair -pr' (primary-range) repairs only the ranges a node is primary for, so it is inherently node-local. Combining -pr with -dc (specificDataCenters) or -hosts (specificHosts) is contradictory and rejected with this RuntimeException before any repair starts.

Solutions

  1. Drop -pr if you need DC/host scoping: `nodetool repair -dc dc1`
  2. Drop the -dc/-hosts flags if you truly want the primary-range repair: `nodetool repair -pr`
  3. Use -pr on each node individually instead of scoping flags

Example fix

// before
nodetool repair -pr -dc dc1
// after
nodetool repair -dc dc1
Defensive patterns

Strategy: validation

Validate before calling

FLAGS="-pr -dc dc1"; [[ "$FLAGS" == *"-pr"* && ( "$FLAGS" == *"-dc"* || "$FLAGS" == *"-hosts"* ) ]] && { echo "-pr cannot combine with -dc/-hosts"; exit 2; }

Prevention

When it happens

Trigger: `nodetool repair -pr -dc dc1`, `nodetool repair -pr -hosts h1`, or `-pr` with any -dc/-hosts combination.

Common situations: Operators trying to scope a primary-range repair to one DC; mixing flags from examples of different repair modes.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/4d009adde0f3028c. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/Repair.java:164

        {
            return PreviewKind.UNREPAIRED;
        }
        else
        {
            return PreviewKind.NONE;
        }
    }

    @Override
    public void execute(NodeProbe probe)
    {
        args = concatArgs(keyspace, tables);

        List<String> keyspaces = parseOptionalKeyspaceNonLocal(args, probe);
        String[] cfnames = parseOptionalTables(args);

        if (primaryRange && (!specificDataCenters.isEmpty() || !specificHosts.isEmpty()))
            throw new RuntimeException("Primary range repair should be performed on all nodes in the cluster.");

        for (String keyspace : keyspaces)
        {
            // avoid repairing system_distributed by default (CASSANDRA-9621)
            if ((args == null || args.isEmpty()) && ONLY_EXPLICITLY_REPAIRED.contains(keyspace))
                continue;

            Map<String, String> options = createOptions(probe::getDataCenter, cfnames);
            try
            {
                probe.repairAsync(probe.output().out, keyspace, options);
            } catch (Exception e)
            {
                throw new RuntimeException("Error occurred during repair", e);
            }
        }
    }

View on GitHub (pinned to 88fd0f6a0e)