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
- Fix the DC name in the reconfigure command to match an existing datacenter
- Add nodes to the target datacenter before including it in CMS placement
- 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
- List DCs with nodetool status / cluster metadata before reconfigure
- Never keep decommissioned DCs in the RF map
- Gate DC additions on at least one node being registered
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
- There are not enough nodes in
- Another sequence of kind
- Can not advance in-progress sequence, since its kind is
- Can not apply in-progress sequence, since its kind is
- Can not parse replication factor from
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 withView on GitHub (pinned to 88fd0f6a0e)