{"record":{"id":"e1c52c36e60b2192","repo":"apache/cassandra","slug":"error-occurred-during-repair","errorCode":null,"errorMessage":"Error occurred during repair","messagePattern":"Error occurred during repair","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/Repair.java","lineNumber":178,"sourceCode":"        List<String> keyspaces = parseOptionalKeyspaceNonLocal(args, probe);\n        String[] cfnames = parseOptionalTables(args);\n\n        if (primaryRange && (!specificDataCenters.isEmpty() || !specificHosts.isEmpty()))\n            throw new RuntimeException(\"Primary range repair should be performed on all nodes in the cluster.\");\n\n        for (String keyspace : keyspaces)\n        {\n            // avoid repairing system_distributed by default (CASSANDRA-9621)\n            if ((args == null || args.isEmpty()) && ONLY_EXPLICITLY_REPAIRED.contains(keyspace))\n                continue;\n\n            Map<String, String> options = createOptions(probe::getDataCenter, cfnames);\n            try\n            {\n                probe.repairAsync(probe.output().out, keyspace, options);\n            } catch (Exception e)\n            {\n                throw new RuntimeException(\"Error occurred during repair\", e);\n            }\n        }\n    }\n\n    public Map<String, String> createOptions(Supplier<String> localDCOption, String[] cfnames)\n    {\n        Map<String, String> options = new HashMap<>();\n        RepairParallelism parallelismDegree = RepairParallelism.PARALLEL;\n        if (sequential)\n            parallelismDegree = RepairParallelism.SEQUENTIAL;\n        else if (dcParallel)\n            parallelismDegree = RepairParallelism.DATACENTER_AWARE;\n        options.put(RepairOption.PARALLELISM_KEY, parallelismDegree.getName());\n        options.put(RepairOption.PRIMARY_RANGE_KEY, Boolean.toString(primaryRange));\n        options.put(RepairOption.INCREMENTAL_KEY, Boolean.toString(!fullRepair && !(paxosOnly && getPreviewKind() == PreviewKind.NONE)));\n        options.put(RepairOption.JOB_THREADS_KEY, Integer.toString(numJobThreads));\n        options.put(RepairOption.TRACE_KEY, Boolean.toString(trace));\n        options.put(RepairOption.COLUMNFAMILIES_KEY, StringUtils.join(cfnames, \",\"));","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/Repair.java#L160-L196","documentation":"Nodetool Repair wraps any exception thrown by the JMX repairAsync call in a RuntimeException 'Error occurred during repair'. The client-side argument parsing succeeded; the node rejected or failed while initiating the asynchronous repair session.","triggerScenarios":"`nodetool repair` when the node cannot start the repair: no common token ranges between nodes, another repair already running (adjacent command conflicts), unknown keyspace/table, or JMX IOException.","commonSituations":"Concurrent repairs colliding ('Two nodes... repair' / 'can not be merged' style node-side errors); typo'd keyspace; repairing after topology changes with out-of-sync range maps.","solutions":["Check node logs for the real cause; look for concurrent-repair conflicts in `nodetool netstats`/tpstats","Ensure no other repair session is running (wait or let it finish)","Verify keyspace/table names","Retry after topology settles; investigate range mismatch if it persists"],"exampleFix":"// before\nnodetool repair nonexistent_ks\n// after\nnodetool repair existing_ks","handlingStrategy":"try-catch","validationCode":"nodetool describecluster | grep -q \"schema disagreement\" && echo \"fix schema first\"","typeGuard":null,"tryCatchPattern":"try { probe.repairAsync(out, ks, options); } catch (RuntimeException e) { log.error(\"repair failed to start: {}\", e.getCause(), e); /* check for concurrent repair, then retry */ throw e; }","preventionTips":["Serialize repairs cluster-wide (no concurrent repair sessions)","Verify keyspace names before repair","Run repairs after topology changes settle"],"tags":["nodetool","repair","jmx"],"backgroundTag":"api-request-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"}