apache/cassandra · error · CasWriteUnknownResultException

CasWriteUnknownResultException(consistencyLevel=%s, acceptCo

Error message

CasWriteUnknownResultException(consistencyLevel=%s, acceptCount=%s, requiredParticipants=%s)

What it means

proposePaxos throws CasWriteUnknownResultException when the Paxos accept phase ended with neither success nor full refusal — some replicas accepted, but quorum was not reached and not all refused. The outcome of the proposal is therefore indeterminate, and Cassandra surfaces consistencyLevel, acceptCount and requiredParticipants so the client knows the result is unknown.

Source

Thrown at src/java/org/apache/cassandra/service/StorageProxy.java:869

                    }
                    catch (Exception ex)
                    {
                        logger.error("Failed paxos propose locally", ex);
                    }
                });
            }
            else
            {
                MessagingService.instance().sendWithCallback(message, replica.endpoint(), callback);
            }
        }
        callback.await();

        if (callback.isSuccessful())
            return true;

        if (backoffIfPartial && !callback.isFullyRefused())
            throw new CasWriteUnknownResultException(replicaPlan.consistencyLevel(), callback.getAcceptCount(), replicaPlan.requiredParticipants());

        return false;
    }

    private static void commitPaxos(Commit proposal, ConsistencyLevel consistencyLevel, boolean allowHints, Dispatcher.RequestTime requestTime) throws WriteTimeoutException
    {
        boolean shouldBlock = consistencyLevel != ConsistencyLevel.ANY;
        Keyspace keyspace = Keyspace.open(proposal.update.metadata().keyspace);

        Token tk = proposal.update.partitionKey().getToken();

        AbstractWriteResponseHandler<Commit> responseHandler = null;
        // NOTE: this ReplicaPlan is a lie, this usage of ReplicaPlan could do with being clarified - the selected() collection is essentially (I think) never used
        ReplicaPlan.ForWrite replicaPlan = ReplicaPlans.forWrite(keyspace, consistencyLevel, tk, ReplicaPlans.writeAll);
        if (shouldBlock)
        {
            AbstractReplicationStrategy rs = replicaPlan.replicationStrategy();
            responseHandler = rs.getWriteResponseHandler(replicaPlan, null, WriteType.SIMPLE, proposal::makeMutation, requestTime);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Re-read the row with the same SERIAL/QUORUM consistency to determine whether the CAS actually applied before retrying.
  2. Retry the LWT after checking current state; do not blind-retry conditional logic that is not idempotent.
  3. Increase write_request_timeout_in_ms to reduce partial-ack windows.
  4. Restore full replica connectivity/health to avoid partial quorums.

Example fix

// before: blind retry
try { casDebit(acct, 10); } catch (CasWriteUnknownResultException e) { casDebit(acct, 10); }
// after: check outcome first
try { casDebit(acct, 10); }
catch (CasWriteUnknownResultException e) {
    Row r = session.execute(serialSelectBalance(acct)).one();
    if (r.getInt("balance") >= 10) casDebit(acct, 10);
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    ResultSet rs = session.execute(lwt);
    return rs.wasApplied();
} catch (CasWriteUnknownResultException e) {
    // outcome indeterminate: verify state at SERIAL before deciding
    Row cur = session.execute(selectAtSerial(key)).one();
    return decideFromCurrentState(cur);
}

Prevention

When it happens

Trigger: A CAS (LWT) whose Paxos propose/accept round got partial acknowledgments within the timeout, with backoffIfPartial enabled: callback.isSuccessful() is false and callback.isFullyRefused() is false.

Common situations: Replica flakiness (partial acks then timeout); network partition affecting a minority of replicas; write timeouts mid-accept. The client cannot tell if the LWT committed.

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