apache/cassandra · critical · IllegalStateException

Unable to find sufficient sources for streaming range in ke

Error message

Unable to find sufficient sources for streaming range  in keyspace  with RF=1. Ensure this keyspace contains replicas in the source datacenter.

What it means

When a range has no sufficient source and the keyspace replication factor is 1, RangeStreamer cannot stream from anywhere. Under strict consistency it throws IllegalStateException telling the operator the source datacenter lacks replicas for this keyspace (RF=1 means the single replica is the only possible source); without strict consistency it only logs a warning that data may be missing.

Source

Thrown at src/java/org/apache/cassandra/dht/RangeStreamer.java:572

             /*
              * When we move forwards (shrink our bucket) we are the one losing a range and no one else loses
              * from that action (we also don't gain). When we move backwards there are two people losing a range. One is a full replica
              * and the other is a transient replica. So we must need fetch from two places in that case for the full range we gain.
              * For a transient range we only need to fetch from one.
              */
             if (useStrictConsistency && addressList.size() > 1 && (addressList.filter(Replica::isFull).size() > 1 || addressList.filter(Replica::isTransient).size() > 1))
                 throw new IllegalStateException(String.format("Multiple strict sources found for %s, sources: %s", toFetch, addressList));

             //We must have enough stuff to fetch from
             if (!any(addressList, isSufficient))
             {
                 if (strat.getReplicationFactor().allReplicas == 1)
                 {
                     if (useStrictConsistency)
                     {
                         logger.warn("A node required to move the data consistently is down");
                         throw new IllegalStateException("Unable to find sufficient sources for streaming range " + toFetch + " in keyspace " + keyspace + " with RF=1. " +
                                                         "Ensure this keyspace contains replicas in the source datacenter.");
                     }
                     else
                         logger.warn("Unable to find sufficient sources for streaming range {} in keyspace {} with RF=1. " +
                                     "Keyspace might be missing data.", toFetch, keyspace);
                 }
                 else
                 {
                     if (useStrictConsistency)
                         logger.warn("A node required to move the data consistently is down");
                     throw new IllegalStateException("Unable to find sufficient sources for streaming range " + toFetch + " in keyspace " + keyspace);
                 }
             }
         }
         return rangesToFetchWithPreferredEndpoints.build();
     }

    /**

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Ensure the keyspace has a replica in the source datacenter: increase RF or ALTER KEYSPACE to NetworkTopologyStrategy with RF>=1 per DC, then run repair before rebuilding
  2. Start the down single replica and rerun the operation
  3. Run rebuild/bootstrap without a DC restriction (or with `nodetool rebuild -- <dc-holding-the-replica>`) so the single replica is reachable
  4. If data loss is acceptable, proceed without strict consistency (warning-only path) and run repair afterwards

Example fix

// before
ALTER KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':1};
nodetool rebuild -- dc2
// after
ALTER KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':1,'dc2':1};
nodetool repair ks
nodetool rebuild -- dc1
Defensive patterns

Strategy: validation

Validate before calling

// Verify source DC holds replicas before rebuilding
KeyspaceMetadata ks = Schema.instance.getKeyspaceMetadata(keyspace);
if (ks.params.replication.asStrategy().getReplicationFactor(sourceDc).allReplicas < 1)
    throw new IllegalArgumentException("Keyspace " + keyspace + " has no replica in source DC " + sourceDc);

Try / catch

try { streamer.fetch(); } catch (IllegalStateException e) { if (e.getMessage().contains("with RF=1")) { fixReplicationOrRestartReplica(); retry(); } else throw e; }

Prevention

When it happens

Trigger: fetchMap()/calculateRangesToFetchWithPreferredEndpoints() with useStrictConsistency=true where a range's sole replica is unavailable (down or filtered out) and strat.getReplicationFactor().allReplicas == 1.

Common situations: Rebuilding a node in a DC where a SimpleStrategy RF=1 keyspace has its only replica elsewhere (e.g. rebuild -- dc2 for a keyspace only replicated in dc1); bootstrapping while the single replica host is down; RF=1 keyspaces during decommission/replace.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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