apache/cassandra · critical · IllegalStateException
Unable to find sufficient sources for streaming range " + tr
Error message
Unable to find sufficient sources for streaming range " + trivialRange + " in keyspace " + keyspace
What it means
RangeFetchMapCalculator.getRangeFetchMapForTrivialRanges() builds the streaming plan for bootstrap/rebuild by mapping each trivial (non-pending, naturally owned) range to a replica source. When no live replica in the local datacenter (and after fallback, the cluster) can serve a range, it throws IllegalStateException: the range cannot be streamed at all.
Source
Thrown at src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java:183
// sort with the endpoint having the least number of streams first:
EndpointsForRange replicas = rangesWithSources.get(trivialRange)
.sorted(Comparator.comparingInt(o -> optimisedMap.get(o.endpoint()).size()));
Replicas.temporaryAssertFull(replicas);
for (Replica replica : replicas)
{
if (passFilters(replica, localDCCheck))
{
added = true;
// if we pass filters, it means that we don't filter away localhost and we can count it as a source,
// see RangeFetchMapCalculator#addEndpoints and RangeStreamer#getRangeFetchMap
if (replica.isSelf())
continue; // but don't add localhost to avoid streaming locally
fetchMap.put(replica.endpoint(), trivialRange);
break;
}
}
if (!added && !localDCCheck)
throw new IllegalStateException("Unable to find sufficient sources for streaming range " + trivialRange + " in keyspace " + keyspace);
if (!added)
logger.info("Using other DC endpoints for streaming for range: {} and keyspace {}", trivialRange, keyspace);
localDCCheck = false;
}
}
return fetchMap;
}
/*
Return the total number of range vertices in the graph
*/
private int getTotalRangeVertices(MutableCapacityGraph<Vertex, Integer> graph)
{
int count = 0;
for (Vertex vertex : graph.getVertices())
{
if (vertex.isRangeVertex())
{
count++;View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Bring the required replicas up and rerun bootstrap/rebuild (check `nodetool status` for down nodes)
- If rebuilding in a new DC, ensure the keyspace uses NetworkTopologyStrategy with an RF > 0 for that DC (ALTER KEYSPACE ... WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3})
- Relax source filters or use nodetool with the appropriate source DC option (e.g. rebuild -- <source_dc>) so valid sources are considered
- Run `nodetool cleanup`/repair after fixing replication to ensure data exists somewhere to stream from
Example fix
// before
ALTER KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':3};
// after
ALTER KEYSPACE ks WITH replication = {'class':'NetworkTopologyStrategy','dc1':3,'dc2':3}; Defensive patterns
Strategy: validation
Validate before calling
// Before rebuild/bootstrap, confirm sources exist in local DC
KeyspaceMetadata ks = Schema.instance.getKeyspaceMetadata(keyspace);
ReplicationFactor rf = ks.params.replication.asStrategy().getReplicationFactor(dc);
if (rf.allReplicas == 0) throw new IllegalArgumentException("Keyspace " + keyspace + " has no replicas in DC " + dc); Try / catch
try { streamer.fetch(); } catch (IllegalStateException e) { if (e.getMessage().contains("Unable to find sufficient sources")) { verifyReplicasUp(); fixReplication(); } else throw e; } Prevention
- Check `nodetool status` for down nodes before bootstrap/rebuild
- Ensure NetworkTopologyStrategy has RF > 0 for every DC involved
- Run repair after changing replication factors
When it happens
Trigger: Calling getRangeFetchMap (via RangeStreamer.fetch) during bootstrap/rebuild where a range's replicas are all filtered out (down nodes, source filters, or replicas absent from the local DC and localDCCheck fails).
Common situations: Bootstrapping a new node while required replicas are down; rebuilding a node in a DC that has no replica for the keyspace (NetworkTopologyStrategy missing the DC); RF configured smaller than needed in the source DC; aggressive snitch/endpoint filters excluding all sources.
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
- Unable to find sufficient sources for streaming range " + ra
- Could not finish join for during replacement
- Cannot alter RF while some endpoints are not in normal state
- Keyspace is already added to fetch map
- Unable to find sufficient sources for streaming range in ke
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/6d953234a0c78166.
Report an issue: GitHub.