{"record":{"id":"b0cb390acb2f5d59","repo":"apache/cassandra","slug":"write-request-failed-due-to-coordinator-behind","errorCode":null,"errorMessage":"Write request failed due to coordinator behind","messagePattern":"Write request failed due to coordinator behind","errorType":"exception","errorClass":"CoordinatorBehindException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java","lineNumber":179,"sourceCode":"            int coordinatorBehindErrors = 0;\n            for (RequestFailureReason reason : failureReasonByEndpoint.values())\n            {\n                if (reason == RETRY_ON_DIFFERENT_TRANSACTION_SYSTEM)\n                    transactionRetryErrors++;\n                if (reason == COORDINATOR_BEHIND)\n                    coordinatorBehindErrors++;\n            }\n            int totalRetriableFailures = transactionRetryErrors + coordinatorBehindErrors;\n\n            // Retrying might fix this\n            if (candidateReplicaCount - failures + totalRetriableFailures  >= blockFor())\n            {\n                // Doesn't matter which we throw really but for clarity/metrics be specific\n                // Retrying on the correct system might make this write succeed\n                if (transactionRetryErrors > 0)\n                    throw new RetryOnDifferentSystemException();\n                if (coordinatorBehindErrors > 0)\n                    throw new CoordinatorBehindException(\"Write request failed due to coordinator behind\");\n            }\n\n            throw new WriteFailureException(replicaPlan.consistencyLevel(), ackCount(), blockFor(), writeType, getFailureReasonByEndpointMap());\n        }\n\n        if (replicaPlan.stillAppliesTo(ClusterMetadata.current()))\n        {\n            if (warningContext != null)\n            {\n                WriteWarningsSnapshot snapshot = warningContext.snapshot();\n                if (!snapshot.isEmpty() && hintOnFailure != null)\n                    CoordinatorWriteWarnings.update(hintOnFailure.get(), snapshot);\n            }\n        }\n    }\n\n    protected WriteWarningContext getWarningContext()\n    {","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java#L161-L197","documentation":"A WriteTimeoutException variant raised by AbstractWriteResponseHandler.get when a paxos/transactional write fails on replicas with failure reason COORDINATOR_BEHIND. The counters show enough retriable failures that a retry (after the coordinator catches up on metadata) could still reach the consistency level, so the failure is surfaced as a retriable write failure rather than an immediate timeout.","triggerScenarios":"Thrown at src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the write; the coordinator behind on cluster metadata should converge","Check cluster connectivity so the coordinator can refresh its view of ring/replica state","If persistent, investigate why the coordinator's cluster metadata lags (CMS/gossip issues)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}