apache/cassandra · error · IllegalArgumentException

data center(s) not found

Error message

data center(s) {datacenters} not found

What it means

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.

Solutions

  1. Check exact DC names with nodetool describecluster or SELECT datacenter FROM system.peers (and local)
  2. Fix the -dc spelling/case in the command or script
  3. Wait for the new DC's nodes to join gossip, or remove the defunct DC name from the repair request

Example fix

// before
nodetool repair -dc DataCenter1 my_keyspace
// after
nodetool repair -dc datacenter1 my_keyspace   # name verified via nodetool describecluster
Defensive patterns

Strategy: validation

Validate before calling

Set<String> existing = ClusterMetadata.current().directory.allDatacenterEndpoints().keys().elementSet();
List<String> missing = requestedDcs.stream().filter(dc -> !existing.contains(dc)).collect(toList());
if (!missing.isEmpty()) throw new IllegalArgumentException("unknown DCs: " + missing);

Try / catch

try { ss.repairAsync(ks, opt); } catch (IllegalArgumentException e) { /* re-derive DC names from cluster metadata */ }

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/292a0da632ce8947. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/service/StorageService.java:3229

    }

    public TokenFactory getTokenFactory()
    {
        return ClusterMetadata.current().partitioner.getTokenFactory();
    }

    private FutureTask<Object> createRepairTask(final int cmd, final String keyspace, final RepairOption options, List<ProgressListener> listeners)
    {
        if (!options.getDataCenters().isEmpty() && !options.getDataCenters().contains(DatabaseDescriptor.getLocalDataCenter()))
        {
            throw new IllegalArgumentException("the local data center must be part of the repair; requested " + options.getDataCenters() + " but DC is " + DatabaseDescriptor.getLocalDataCenter());
        }
        Set<String> existingDatacenters = ClusterMetadata.current().directory.allDatacenterEndpoints().keys().elementSet();
        List<String> datacenters = new ArrayList<>(options.getDataCenters());
        if (!existingDatacenters.containsAll(datacenters))
        {
            datacenters.removeAll(existingDatacenters);
            throw new IllegalArgumentException("data center(s) " + datacenters.toString() + " not found");
        }

        RepairCoordinator task = new RepairCoordinator(this, cmd, options, keyspace);
        task.addProgressListener(progressSupport);
        for (ProgressListener listener : listeners)
            task.addProgressListener(listener);

        if (options.isTraced())
            return new FutureTaskWithResources<>(() -> ExecutorLocals::clear, task);
        return new FutureTask<>(task);
    }

    public RepairCoordinator newRepairCoordinator(String keyspace, RepairOption options)
    {
        int cmd = nextRepairCommand.incrementAndGet();
        return new RepairCoordinator(this, cmd, options, keyspace);
    }

View on GitHub (pinned to 88fd0f6a0e)