apache/cassandra · error

Read on table has exceeded the size failure threshold of…

Error message

Read on table %s has exceeded the size failure threshold of %,d bytes with ...

What it means

When a coordinator read result exceeds cassandra.coordinator_read_size_failure_threshold_kb, the query is rejected with an exception to protect the coordinator from OOM, and the client also receives this warning text via ClientWarn before the failure is raised.

Solutions

  1. Restrict the query with partition key and LIMIT so the result stays under the threshold
  2. Page the read (driver fetch size) so each page is bounded
  3. Raise cassandra.coordinator_read_size_failure_threshold_kb only with capacity planning
  4. Redesign the data model to bound partition sizes

Example fix

// before
SELECT * FROM events; // exceeds failure threshold, aborted
// after
SELECT * FROM events WHERE day = ? AND device_id = ? LIMIT 5000; // bounded read
Defensive patterns

Strategy: try-catch

Validate before calling

if (!cql.toLowerCase().contains("limit") && !hasPartitionKeyRestriction(cql)) {
    throw new IllegalArgumentException("read would likely exceed failure threshold; add LIMIT");
}

Try / catch

try {
    session.execute(stmt);
} catch (DriverException e) {
    if (e.getMessage().contains("exceeded the size failure threshold")) {
        // retry with paging / narrower WHERE / LIMIT
    } else throw e;
}

Prevention

When it happens

Trigger: SELECT whose computed result size crosses the abort/failure threshold; result.shouldReject(options.getCoordinatorReadSizeAbortThresholdBytes()) triggers rejection; the coordinator aborts the read.

Common situations: Reading multi-GB partitions; thresholds tightened for stability; unbounded scans on tables with poor data models; large IN queries over wide partitions.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/SelectStatement.java:1155

            String msg = String.format("Read on table %s has exceeded the size warning threshold of %,d bytes", table, options.getCoordinatorReadSizeWarnThresholdBytes());
            ClientState state = ClientState.forInternalCalls();
            ClientWarn.instance.warn(msg + " with " + loggableTokens(options, state));
            logger.warn("{} with query {}", msg, asCQL(options, state));
            if (store != null)
                store.metric.coordinatorReadSizeWarnings.mark();
        }
    }

    private void maybeFail(ResultSetBuilder result, QueryOptions options)
    {
        if (!options.isReadThresholdsEnabled())
            return;
        if (result.shouldReject(options.getCoordinatorReadSizeAbortThresholdBytes()))
        {
            String msg = String.format("Read on table %s has exceeded the size failure threshold of %,d bytes", table, options.getCoordinatorReadSizeAbortThresholdBytes());
            ClientState state = ClientState.forInternalCalls();
            String clientMsg = msg + " with " + loggableTokens(options, state);
            ClientWarn.instance.warn(clientMsg);
            logger.warn("{} with query {}", msg, asCQL(options, state));
            ColumnFamilyStore store = cfs();
            if (store != null)
            {
                store.metric.coordinatorReadSizeAborts.mark();
                store.metric.coordinatorReadSize.update(result.getSize());
            }
            // read errors require blockFor and recieved (its in the protocol message), but this isn't known;
            // to work around this, treat the coordinator as the only response we care about and mark it failed
            ReadSizeAbortException exception = new ReadSizeAbortException(clientMsg, options.getConsistency(), 0, 1, true,
                                                                          ImmutableMap.of(FBUtilities.getBroadcastAddressAndPort(), RequestFailureReason.READ_SIZE));
            StorageProxy.recordReadRegularAbort(options.getConsistency(), exception);
            throw exception;
        }
    }

    private ColumnFamilyStore cfs()
    {

View on GitHub (pinned to 88fd0f6a0e)