{"record":{"id":"6a017e2db2e9fcfb","repo":"apache/cassandra","slug":"there-are-no-nodes-in-s-datacenter","errorCode":null,"errorMessage":"There are no nodes in %s datacenter","messagePattern":"There are no nodes in (.+?) datacenter","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/CMSPlacementStrategy.java","lineNumber":73,"sourceCode":"        this(rf, new DefaultNodeFilter(filter));\n    }\n\n    @VisibleForTesting\n    public CMSPlacementStrategy(Map<String, Integer> rf, BiFunction<ClusterMetadata, NodeId, Boolean> filter)\n    {\n        // todo: verify only test uses with other filter\n        this.rf = rf;\n        this.filter = filter;\n    }\n\n    public Set<NodeId> reconfigure(ClusterMetadata metadata)\n    {\n        Map<String, ReplicationFactor> rf = new HashMap<>(this.rf.size());\n        for (Map.Entry<String, Integer> e : this.rf.entrySet())\n        {\n            Collection<InetAddressAndPort> nodesInDc = metadata.directory.allDatacenterEndpoints().get(e.getKey());\n            if (nodesInDc.isEmpty())\n                throw new IllegalStateException(String.format(\"There are no nodes in %s datacenter\", e.getKey()));\n            if (nodesInDc.size() < e.getValue())\n                throw new Transformation.RejectedTransformationException(String.format(\"There are not enough nodes in %s datacenter to satisfy replication factor\", e.getKey()));\n\n            rf.put(e.getKey(), ReplicationFactor.fullOnly(e.getValue()));\n        }\n\n        Directory tmpDirectory = metadata.directory;\n        TokenMap tmpTokenMap = metadata.tokenMap;\n        for (NodeId peerId : metadata.directory.peerIds())\n        {\n            if (!filter.apply(metadata, peerId))\n            {\n                tmpDirectory = tmpDirectory.without(metadata.nextEpoch(), peerId);\n                tmpTokenMap = tmpTokenMap.unassignTokens(peerId);\n            }\n        }\n\n        // Although MetaStrategy has its own entireRange, it uses a custom partitioner which isn't compatible with","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/CMSPlacementStrategy.java#L55-L91","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","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"],"exampleFix":"// before\nnodetool cms reconfigure 3 --dc NonExistentDc\n\n// after (use a DC reported by nodetool status)\nnodetool cms reconfigure 3 --dc datacenter1","handlingStrategy":"validation","validationCode":"ClusterMetadata metadata = ...;\nfor (String dc : requestedRf.keySet()) {\n    Collection<InetAddressAndPort> nodes = metadata.directory.allDatacenterEndpoints().get(dc);\n    if (nodes == null || nodes.isEmpty()) throw new IllegalArgumentException(\"No nodes in DC \" + dc);\n}","typeGuard":null,"tryCatchPattern":"try { cms.reconfigure(rf); } catch (IllegalStateException | Transformation.RejectedTransformationException e) { logger.error(\"CMS reconfigure rejected: {}\", e.getMessage()); }","preventionTips":["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"],"tags":["cms","placement","datacenter"],"backgroundTag":"entity-not-found","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"}