apache/cassandra · error · IllegalArgumentException

The specified range %s is not a range that is owned by this

Error message

The specified range %s is not a range that is owned by this node. Please ensure that all token ranges specified to be rebuilt belong to this node.

What it means

Each user-specified token range must be contained within a range this node currently owns (its local replicas); ranges not owned by the node are rejected because the node cannot stream ranges it does not hold.

Source

Thrown at src/java/org/apache/cassandra/service/Rebuild.java:226

        // Ensure all specified ranges are actually ranges owned by this host
        RangesAtEndpoint localReplicas = StorageService.instance.getLocalReplicas(keyspace);
        RangesAtEndpoint.Builder streamRanges = new RangesAtEndpoint.Builder(getBroadcastAddressAndPort(), ranges.size());
        for (Range<Token> specifiedRange : ranges)
        {
            boolean foundParentRange = false;
            for (Replica localReplica : localReplicas)
            {
                if (localReplica.contains(specifiedRange))
                {
                    streamRanges.add(localReplica.decorateSubrange(specifiedRange));
                    foundParentRange = true;
                    break;
                }
            }
            if (!foundParentRange)
            {
                throw new IllegalArgumentException(String.format("The specified range %s is not a range that is owned by this node. Please ensure that all token ranges specified to be rebuilt belong to this node.", specifiedRange.toString()));
            }
        }
        return streamRanges.build();
    }

    private static MovementMap movementMap(ClusterMetadata metadata, String keyspace, String tokens)
    {
        MovementMap.Builder movementMapBuilder = MovementMap.builder();
        if (keyspace == null)
        {
            metadata.placements().forEach((params, placement) -> movementMapBuilder.put(params, addMovementsForParams(placement, null)));
            // Special case to include the system metadata keyspace
            ReplicationParams metaParams = Keyspace.open(METADATA_KEYSPACE_NAME).getMetadata().params.replication;
            movementMapBuilder.put(metaParams, addMovementsForParams(metadata.placement(metaParams), null));
        }
        else if (tokens == null)
        {
            ReplicationParams params = Keyspace.open(keyspace).getMetadata().params.replication;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Verify current ownership with `nodetool ring` / `nodetool describering <keyspace>` and pass only ranges the node owns
  2. Omit the tokens argument to rebuild all locally owned ranges
  3. Recompute ranges after any pending topology operations (bootstrap/decommission) settle

Example fix

// before (range not owned)
nodetool rebuild -ks ks1 --tokens "(0,100]"
// after (query ownership first, then use owned range)
nodetool describering ks1
nodetool rebuild -ks ks1 --tokens "(-9223372036854775808,-4611686018427387904]"
Defensive patterns

Strategy: validation

Validate before calling

RangesAtEndpoint owned = StorageService.instance.getLocalReplicas(keyspace);
for (Range<Token> r : requested)
    if (owned.simpleRanges().noneMatch(o -> o.range().contains(r)))
        throw new IllegalArgumentException("range not owned: " + r);

Prevention

When it happens

Trigger: rebuild with tokens containing a range outside the node's current ownership for the given keyspace — e.g. after ring changes, wrong keyspace RF/replication, or ranges belonging to another node.

Common situations: Token ranges captured before topology changes; specifying ranges of a different node; keyspace with different replication strategy than expected; rebuild on a node that just bootstrapped and owns fewer ranges.

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/92973634be0e87db. Report an issue: GitHub.