{"record":{"id":"292a0da632ce8947","repo":"apache/cassandra","slug":"data-center-s-datacenters-not-found","errorCode":null,"errorMessage":"data center(s) {datacenters} not found","messagePattern":"data center\\(s\\) (.+?) not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":3229,"sourceCode":"    }\n\n    public TokenFactory getTokenFactory()\n    {\n        return ClusterMetadata.current().partitioner.getTokenFactory();\n    }\n\n    private FutureTask<Object> createRepairTask(final int cmd, final String keyspace, final RepairOption options, List<ProgressListener> listeners)\n    {\n        if (!options.getDataCenters().isEmpty() && !options.getDataCenters().contains(DatabaseDescriptor.getLocalDataCenter()))\n        {\n            throw new IllegalArgumentException(\"the local data center must be part of the repair; requested \" + options.getDataCenters() + \" but DC is \" + DatabaseDescriptor.getLocalDataCenter());\n        }\n        Set<String> existingDatacenters = ClusterMetadata.current().directory.allDatacenterEndpoints().keys().elementSet();\n        List<String> datacenters = new ArrayList<>(options.getDataCenters());\n        if (!existingDatacenters.containsAll(datacenters))\n        {\n            datacenters.removeAll(existingDatacenters);\n            throw new IllegalArgumentException(\"data center(s) \" + datacenters.toString() + \" not found\");\n        }\n\n        RepairCoordinator task = new RepairCoordinator(this, cmd, options, keyspace);\n        task.addProgressListener(progressSupport);\n        for (ProgressListener listener : listeners)\n            task.addProgressListener(listener);\n\n        if (options.isTraced())\n            return new FutureTaskWithResources<>(() -> ExecutorLocals::clear, task);\n        return new FutureTask<>(task);\n    }\n\n    public RepairCoordinator newRepairCoordinator(String keyspace, RepairOption options)\n    {\n        int cmd = nextRepairCommand.incrementAndGet();\n        return new RepairCoordinator(this, cmd, options, keyspace);\n    }\n","sourceCodeStart":3211,"sourceCodeEnd":3247,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L3211-L3247","documentation":"After validating the local DC, createRepairTask checks that every requested datacenter actually has live endpoints registered in cluster metadata; any DC name with no known nodes causes IllegalArgumentException listing the missing names.","triggerScenarios":"`nodetool repair -dc <name>` where <name> is misspelled, renamed, or refers to a DC whose nodes are all down/decommissioned; calling StorageService.repairAsync programmatically with a stale DC name.","commonSituations":"Typos in -dc (case-sensitive); DC renamed in cassandra-rackdc.properties after a migration; scripted repairs referencing decommissioned datacenters; running repair before all nodes of a new DC have joined.","solutions":["Check exact DC names with nodetool describecluster or SELECT datacenter FROM system.peers (and local)","Fix the -dc spelling/case in the command or script","Wait for the new DC's nodes to join gossip, or remove the defunct DC name from the repair request"],"exampleFix":"// before\nnodetool repair -dc DataCenter1 my_keyspace\n// after\nnodetool repair -dc datacenter1 my_keyspace   # name verified via nodetool describecluster","handlingStrategy":"validation","validationCode":"Set<String> existing = ClusterMetadata.current().directory.allDatacenterEndpoints().keys().elementSet();\nList<String> missing = requestedDcs.stream().filter(dc -> !existing.contains(dc)).collect(toList());\nif (!missing.isEmpty()) throw new IllegalArgumentException(\"unknown DCs: \" + missing);","typeGuard":null,"tryCatchPattern":"try { ss.repairAsync(ks, opt); } catch (IllegalArgumentException e) { /* re-derive DC names from cluster metadata */ }","preventionTips":["Source -dc values from nodetool describecluster rather than hardcoding","Update scripts after DC renames or migrations","Ensure all nodes of a new DC have joined before repairing it"],"tags":["cassandra","repair","datacenter","validation"],"backgroundTag":"resource-not-found","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"}