{"record":{"id":"58f0adc8573c9d98","repo":"apache/cassandra","slug":"dynamic-caller-supplied-message-repairexception","errorCode":null,"errorMessage":"(dynamic, caller-supplied message) RepairException.warn factory","messagePattern":"\\(dynamic, caller-supplied message\\) RepairException\\.warn factory","errorType":"exception","errorClass":"RepairException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/exceptions/RepairException.java","lineNumber":48,"sourceCode":"    private final boolean shouldLogWarn;\n\n    private RepairException(@Nullable RepairJobDesc desc, PreviewKind previewKind, String message, boolean shouldLogWarn)\n    {\n        this((desc == null ? \"\" : desc.toString(previewKind != null ? previewKind : PreviewKind.NONE)) + ' ' + message, shouldLogWarn);\n    }\n\n    private RepairException(String msg, boolean shouldLogWarn)\n    {\n        super(msg);\n        this.shouldLogWarn = shouldLogWarn;\n    }\n\n    public static RepairException error(@Nullable RepairJobDesc desc, PreviewKind previewKind, String message)\n    {\n        return new RepairException(desc, previewKind, message, false);\n    }\n\n    public static RepairException warn(@Nullable RepairJobDesc desc, PreviewKind previewKind, String message)\n    {\n        return new RepairException(desc, previewKind, message, true);\n    }\n\n    public static RepairException warn(String message)\n    {\n        return new RepairException(message, true);\n    }\n\n    public static boolean shouldWarn(Throwable throwable)\n    {\n        return throwable instanceof RepairException && ((RepairException)throwable).shouldLogWarn;\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/exceptions/RepairException.java#L30-L63","documentation":"RepairException.warn(desc, previewKind, message) is a factory creating a RepairException marked as a 'warn' severity increment repair failure. The message is fully caller-supplied; typical contents include repair session failures, unrepaired-range mismatches, timeouts during validation/sync stages. It is usually surfaced to `nodetool repair` clients or logged by the repair coordinator.","triggerScenarios":"Any repair job stage (ValidationTask, SyncTask, RepairSession) that calls RepairException.warn with a session-specific message when a repair step fails in a way deemed non-fatal/warning-worthy, e.g. a node stopped responding during validation or preview mismatch found during `nodetool repair --preview`.","commonSituations":"Preview repair (`nodetool repair --preview`) detecting inconsistencies between replicas; incremental repair sessions hitting timeouts; anti-compaction or sync failures while a node is overloaded or down.","solutions":["Read the caller-supplied message: it names the repair job desc and the specific stage that failed.","Re-run `nodetool repair` on the affected keyspace/ranges once all replica nodes are up and not overloaded.","Check the logs of every replica in the repaired range for the underlying cause (GC pauses, dropped messages, timeouts).","If preview reported inconsistencies, run a full (non-preview) repair to reconcile the replicas."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure all replicas are UP before repairing\nSet<InetAddressAndPort> down = endpoints.stream().filter(ep -> !Gossiper.instance.isAlive(ep)).collect(Collectors.toSet());\nif (!down.isEmpty()) throw new IllegalArgumentException(\"Refusing repair, nodes down: \" + down);","typeGuard":null,"tryCatchPattern":"try { repairService.repair(ks, tables, options); } catch (RepairException e) { if (RepairException.shouldWarn(e)) logger.warn(\"Repair warning: {}\", e.getMessage()); else throw e; }","preventionTips":["Repair only when all replicas are up and not overloaded.","Avoid running concurrent repairs on overlapping ranges.","Watch preview output and reconcile with a full repair when mismatches appear.","Check replica logs for GC/dropped-message causes after a warn-level failure."],"tags":["repair","anti-entropy","consistency"],"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-17T15:17:12.973Z"}