{"record":{"id":"4d19ab2e77c357e5","repo":"apache/cassandra","slug":"incremental-repair-session-s-has-failed","errorCode":null,"errorMessage":"Incremental repair session %s has failed","messagePattern":"Incremental repair session (.+?) has failed","errorType":"exception","errorClass":"RepairException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java","lineNumber":324,"sourceCode":"    }\n\n    public synchronized void fail()\n    {\n        Set<Map.Entry<InetAddressAndPort, State>> cantFail = participantStates.entrySet()\n                                                                              .stream()\n                                                                              .filter(entry -> !entry.getValue().canTransitionTo(State.FAILED))\n                                                                              .collect(Collectors.toSet());\n        if (!cantFail.isEmpty())\n        {\n            logger.error(\"Can't transition endpoints {} to FAILED\", cantFail, new RuntimeException());\n            return;\n        }\n        logger.info(\"Incremental repair session {} failed\", sessionID);\n        sendFailureMessageToParticipants();\n        setAll(State.FAILED);\n\n        String exceptionMsg = String.format(\"Incremental repair session %s has failed\", sessionID);\n        finalizeProposeFuture.tryFailure(RepairException.warn(exceptionMsg));\n        prepareFuture.tryFailure(RepairException.warn(exceptionMsg));\n    }\n\n    private static String formatDuration(long then, long now)\n    {\n        if (then == Long.MIN_VALUE || now == Long.MIN_VALUE)\n        {\n            // if neither of the times were initially set, don't return a non-sensical answer\n            return \"n/a\";\n        }\n        return DurationFormatUtils.formatDurationWords(now - then, true, true);\n    }\n\n    /**\n     * Runs the asynchronous consistent repair session. Actual repair sessions are scheduled via a submitter to make unit testing easier\n     */\n    public Future<CoordinatedRepairResult> execute(Supplier<Future<CoordinatedRepairResult>> sessionSubmitter)\n    {","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/repair/consistent/CoordinatorSession.java#L306-L342","documentation":"The first of two failure futures set in CoordinatorSession.fail(): when the incremental repair session fails, the coordinator propagates the failure into finalizeProposeFuture and prepareFuture so waiting callers (e.g. repair scheduling) see a RepairException. This index marks the finalizePropose failure.","triggerScenarios":"fail() is called from handlePrepareResponse (a replica rejected prepare), handleFinalizePromise (a replica rejected finalize), execute (coordinator-side error), or handleFailSessionMessage (a replica reported session failure).","commonSituations":"Replica down or unreachable mid-session, replica failing prepare due to ongoing operations, validate/finalize timeouts (repair_command_pool_size, cas timeouts), or a participant node crashing during the incremental repair protocol.","solutions":["Inspect participant node logs for the underlying prepare/finalize failure.","Ensure all replicas of the repaired ranges are up and reachable; re-run repair after restoring them.","Check for concurrent operations blocking prepare (e.g. ongoing repairs on replicas, pending compactions).","Increase repair timeouts if finalize/prepare are timing out under load.","Use nodetool downloadschedules/repair_admin commands (or rerun repair) to clean up failed session state."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Verify all participants up and no prior session active:\n// nodetool status\n// SELECT * FROM system.repairs WHERE state != 'COMPLETED';","typeGuard":null,"tryCatchPattern":"try {\n    repair(keyspace, incremental = true);\n} catch (RepairException e) {\n    if (e.getMessage().matches(\"Incremental repair session .* has failed\")) {\n        // check system.repairs for session state; rerun after node recovery\n    }\n}","preventionTips":["Schedule incremental repairs only when all replicas are stable.","Avoid topology changes during repair windows.","Monitor repair success metrics and alert on session failures.","Investigate replica-side prepare/finalize rejections promptly."],"tags":["repair","incremental-repair","distributed-consensus","cassandra"],"backgroundTag":"repair-session-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}