apache/cassandra · critical · IllegalStateException

Unable to find sufficient sources for streaming range " + ra

Error message

Unable to find sufficient sources for streaming range " + range + " in keyspace " + keyspace

What it means

RangeFetchMapCalculator.getGraph() constructs a flow/capacity graph for non-trivial (pending) range movements and solves for fetch mappings. If, for a given range, addEndpoints() cannot find any live, filter-passing source endpoint even after allowing other-DC endpoints, it throws IllegalStateException — the streaming plan is infeasible.

Source

Thrown at src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java:342

            if (trivialRanges.contains(range))
            {
                logger.debug("Not optimising trivial range {} for keyspace {}", range, keyspace);
                continue;
            }

            final RangeVertex rangeVertex = new RangeVertex(range);

            //Try to only add source endpoints from same DC
            boolean sourceFound = addEndpoints(capacityGraph, rangeVertex, true);

            if (!sourceFound)
            {
                logger.info("Using other DC endpoints for streaming for range: {} and keyspace {}", range, keyspace);
                sourceFound = addEndpoints(capacityGraph, rangeVertex, false);
            }

            if (!sourceFound)
                throw new IllegalStateException("Unable to find sufficient sources for streaming range " + range + " in keyspace " + keyspace);

        }

        return capacityGraph;
    }

    /**
     * Create edges with infinite capacity b/w range vertex and all its source endpoints which clear the filters
     * @param capacityGraph The Capacity graph on which changes are made
     * @param rangeVertex The range for which we need to add all its source endpoints
     * @param localDCCheck Should add source endpoints from local DC only
     * @return If we were able to add atleast one source for this range after applying filters to endpoints
     */
    private boolean addEndpoints(MutableCapacityGraph<Vertex, Integer> capacityGraph, RangeVertex rangeVertex, boolean localDCCheck)
    {
        boolean sourceFound = false;
        Replicas.temporaryAssertFull(rangesWithSources.get(rangeVertex.getRange()));
        for (Replica replica : rangesWithSources.get(rangeVertex.getRange()))

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Ensure all replicas owning the pending ranges are alive (nodetool status) before resuming the operation
  2. Retry the operation after the failed node recovers, or force a rebuild from a healthy source DC (nodetool rebuild -- <dc>)
  3. Review sourceFilters (RangeStreamer source filter configuration) and relax them so at least one replica qualifies
  4. Re-run repair to converge data if the operation failed mid-move, then retry
Defensive patterns

Strategy: validation

Validate before calling

for (Range<Token> pending : pendingRanges)
    if (tokenMetadata.getReplicasForReading(pending).stream().noneMatch(r -> failureDetector.isAlive(r.endpoint())))
        throw new IllegalStateException("No live source for pending range " + pending);

Try / catch

try { streamer.fetch(); } catch (IllegalStateException e) { if (e.getMessage().contains("Unable to find sufficient sources for streaming range")) { waitForReplicasUp(); retryFetch(); } else throw e; }

Prevention

When it happens

Trigger: Calling getRangeFetchMapForNonTrivialRanges via getRangeFetchMap during bootstrap/replace/move where a pending range has no available live replica sources after source filters and DC-preference are applied.

Common situations: Range movements (nodetool move/decommission mid-flight) where the previous owner is down; strict endpoint-snitch configs where all replicas for a pending range sit in unavailable hosts; source filters (e.g. only-stream-from-same-DC) excluding everything.

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