apache/cassandra · error · TimeoutException

Truncate timed out - received only

Error message

Truncate timed out - received only {responses} responses

What it means

Thrown by TruncateResponseHandler.get() when the coordinator does not receive acknowledgements from all required replicas for a TRUNCATE command within the truncation request timeout. It indicates at least one replica did not confirm the truncation in time, so the coordinator cannot guarantee the table data was removed everywhere.

Solutions

  1. Check nodetool status / logs on replicas holding the table and restart or repair any down or unresponsive replica, then retry the TRUNCATE.
  2. Raise the timeout: increase truncate_request_timeout_in_ms (and request_timeout_in_ms) in cassandra.yaml.
  3. Retry the TRUNCATE after the cluster is healthy; truncation is idempotent for remaining data.
  4. If a replica permanently failed the truncation, inspect its logs for TruncateException and run repair or re-truncate after fixing it.

Example fix

// before (cassandra.yaml)
truncate_request_timeout_in_ms: 60000
// after
truncate_request_timeout_in_ms: 120000
Defensive patterns

Strategy: try-catch

Validate before calling

// before truncate
ClusterHealth ok = replicasUpForTable(keyspace, table); // nodetool status / driver metadata
if (!ok.allReplicasUp()) throw new IllegalStateException("Fix replicas before TRUNCATE");

Try / catch

try {
    session.execute("TRUNCATE ks.tbl");
} catch (TimeoutException e) {
    logger.warn("Truncate timed out; verify replicas then retry", e);
    retryTruncateWithBackoff(keyspace, table);
}

Prevention

When it happens

Trigger: Running TRUNCATE (or via Table.truncate) when one or more replicas holding the table fail to respond to the TruncateVerb before the request timeout expires; responses.get() counts acks received so far.

Common situations: A replica node is down, overloaded (GC pauses, overloaded coordinator), network latency/partition between coordinator and replicas, or truncating a very large table where replica-side truncation work exceeds the timeout.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/service/TruncateResponseHandler.java:77

        this.responseCount = responseCount;
        start = nanoTime();
    }

    public void get() throws TimeoutException
    {
        long timeoutNanos = getTruncateRpcTimeout(NANOSECONDS) - (nanoTime() - start);
        boolean signaled;
        try
        {
            signaled = condition.await(timeoutNanos, NANOSECONDS); // TODO truncate needs a much longer timeout
        }
        catch (InterruptedException e)
        {
            throw new UncheckedInterruptedException(e);
        }

        if (!signaled)
            throw new TimeoutException("Truncate timed out - received only " + responses.get() + " responses");

        if (!failureReasonByEndpoint.isEmpty())
        {
            // clone to make sure no race condition happens
            Map<InetAddressAndPort, RequestFailureReason> failureReasonByEndpoint = new HashMap<>(this.failureReasonByEndpoint);
            if (RequestCallback.isTimeout(failureReasonByEndpoint))
                throw new TimeoutException("Truncate timed out - received only " + responses.get() + " responses");

            StringBuilder sb = new StringBuilder("Truncate failed on ");
            for (Map.Entry<InetAddressAndPort, RequestFailureReason> e : failureReasonByEndpoint.entrySet())
                sb.append("replica ").append(e.getKey()).append(" -> ").append(e.getValue()).append(", ");
            sb.setLength(sb.length() - 2);
            throw new TruncateException(sb.toString());
        }
    }

    @Override
    public void onResponse(Message<TruncateResponse> message)

View on GitHub (pinned to 88fd0f6a0e)