apache/cassandra · error · IllegalStateException

There are no nodes in

Error message

There are no nodes in %s datacenter

What it means

Thrown by CMSPlacementStrategy.reconfigure() as an IllegalStateException when a datacenter listed in the configured RF map has zero registered nodes in cluster metadata. A CMS with placements in an empty DC cannot be built, so the transformation is refused.

Solutions

  1. Fix the DC name in the reconfigure command to match an existing datacenter
  2. Add nodes to the target datacenter before including it in CMS placement
  3. Remove the empty DC from the requested RF map

Example fix

// before
nodetool cms reconfigure 3 --dc NonExistentDc

// after (use a DC reported by nodetool status)
nodetool cms reconfigure 3 --dc datacenter1
Defensive patterns

Strategy: validation

Validate before calling

ClusterMetadata metadata = ...;
for (String dc : requestedRf.keySet()) {
    Collection<InetAddressAndPort> nodes = metadata.directory.allDatacenterEndpoints().get(dc);
    if (nodes == null || nodes.isEmpty()) throw new IllegalArgumentException("No nodes in DC " + dc);
}

Try / catch

try { cms.reconfigure(rf); } catch (IllegalStateException | Transformation.RejectedTransformationException e) { logger.error("CMS reconfigure rejected: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling reconfigure (via prepareNewCMS/newCms, e.g. nodetool cms reconfigure) with a datacenter in the requested RF map that currently has no members in metadata.directory.allDatacenterEndpoints().

Common situations: nodetool cms reconfigure --dc with a typo'd DC name; DC fully decommissioned but still in the placement config; CMS reconfiguration issued before any nodes joined the new DC.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/locator/CMSPlacementStrategy.java:73

        this(rf, new DefaultNodeFilter(filter));
    }

    @VisibleForTesting
    public CMSPlacementStrategy(Map<String, Integer> rf, BiFunction<ClusterMetadata, NodeId, Boolean> filter)
    {
        // todo: verify only test uses with other filter
        this.rf = rf;
        this.filter = filter;
    }

    public Set<NodeId> reconfigure(ClusterMetadata metadata)
    {
        Map<String, ReplicationFactor> rf = new HashMap<>(this.rf.size());
        for (Map.Entry<String, Integer> e : this.rf.entrySet())
        {
            Collection<InetAddressAndPort> nodesInDc = metadata.directory.allDatacenterEndpoints().get(e.getKey());
            if (nodesInDc.isEmpty())
                throw new IllegalStateException(String.format("There are no nodes in %s datacenter", e.getKey()));
            if (nodesInDc.size() < e.getValue())
                throw new Transformation.RejectedTransformationException(String.format("There are not enough nodes in %s datacenter to satisfy replication factor", e.getKey()));

            rf.put(e.getKey(), ReplicationFactor.fullOnly(e.getValue()));
        }

        Directory tmpDirectory = metadata.directory;
        TokenMap tmpTokenMap = metadata.tokenMap;
        for (NodeId peerId : metadata.directory.peerIds())
        {
            if (!filter.apply(metadata, peerId))
            {
                tmpDirectory = tmpDirectory.without(metadata.nextEpoch(), peerId);
                tmpTokenMap = tmpTokenMap.unassignTokens(peerId);
            }
        }

        // Although MetaStrategy has its own entireRange, it uses a custom partitioner which isn't compatible with

View on GitHub (pinned to 88fd0f6a0e)