apache/cassandra · error · IllegalArgumentException

The current host must be part of the repair

Error message

The current host must be part of the repair

What it means

filterNeighbors requires that the local (broadcast) address be included in the explicitly specified host list for a sub-range repair; otherwise the operation is rejected. The repair must run on this node and it must know it participates in the specified replica set.

Solutions

  1. Add the local node's address to the -hosts list
  2. Run the repair command on a node that is part of the specified host set

Example fix

// before
nodetool repair keyspace1 -hosts 10.0.0.2,10.0.0.3  # issued on 10.0.0.1
// after
nodetool repair keyspace1 -hosts 10.0.0.1,10.0.0.2,10.0.0.3
Defensive patterns

Strategy: validation

Validate before calling

// ensure local node's broadcast address is in the host list
InetAddressAndPort local = FBUtilities.getBroadcastAddressAndPort();
if (!hostList.contains(local)) throw new IllegalArgumentException("local node must be in -hosts");

Try / catch

try { repair(...); }
catch (IllegalArgumentException e) {
    if (e.getMessage().equals("The current host must be part of the repair")) addSelfToHosts();
    throw e;
}

Prevention

When it happens

Trigger: Calling nodetool repair -hosts h1,h2 (with -st/-et) where the node receiving the command is not listed among the hosts.

Common situations: Operators running sub-range repairs from a coordinator node and forgetting to include that node's own address in the -hosts list.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/service/ActiveRepairService.java:649

        else if (hosts != null && !hosts.isEmpty())
        {
            Set<InetAddressAndPort> specifiedHost = new HashSet<>();
            for (final String host : hosts)
            {
                try
                {
                    final InetAddressAndPort endpoint = InetAddressAndPort.getByName(host.trim());
                    if (endpoint.equals(ctx.broadcastAddressAndPort()) || neighbors.endpoints().contains(endpoint))
                        specifiedHost.add(endpoint);
                }
                catch (UnknownHostException e)
                {
                    throw new IllegalArgumentException("Unknown host specified " + host, e);
                }
            }

            if (!specifiedHost.contains(ctx.broadcastAddressAndPort()))
                throw new IllegalArgumentException("The current host must be part of the repair");

            if (specifiedHost.size() <= 1)
            {
                String msg = "Specified hosts %s do not share range %s needed for repair. Either restrict repair ranges " +
                             "with -st/-et options, or specify one of the neighbors that share this range with " +
                             "this node: %s.";
                throw new IllegalArgumentException(String.format(msg, hosts, toRepair, neighbors));
            }

            specifiedHost.remove(ctx.broadcastAddressAndPort());
            return neighbors.keep(specifiedHost);
        }

        return neighbors;
    }

    /**
     * we only want to set repairedAt for incremental repairs including all replicas for a token range. For non-global

View on GitHub (pinned to 88fd0f6a0e)