{"record":{"id":"1237ad3e56e480ed","repo":"apache/cassandra","slug":"dc-name-must-not-be-empty","errorCode":null,"errorMessage":"dc name must not be empty","messagePattern":"dc name must not be empty","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java","lineNumber":126,"sourceCode":"\n        @Override\n        public int compareTo(@Nonnull WeightedDc that)\n        {\n            int cmp = Integer.compare(this.weight, that.weight);\n            if (cmp != 0) return cmp;\n            return this.name.compareTo(that.name);\n        }\n\n        public String toString()\n        {\n            return autoWeight ? name : name + ':' + weight;\n        }\n\n        static String validateDC(String dc)\n        {\n            dc = dc.trim();\n            if (dc.isEmpty())\n                throw cfe(\"dc name must not be empty\", DCS);\n            return dc;\n        }\n\n        static int validateWeight(String w)\n        {\n            int weight = Integer.parseInt(w);\n            if (weight < 0)\n                throw cfe(\"DC weights must be zero or positive\");\n            return weight;\n        }\n\n        static WeightedDc fromString(String s, int idx)\n        {\n            s = s.trim();\n            if (s.isEmpty())\n                throw cfe(\"%s entries must not be empty\", DCS);\n\n            String[] parts = COLON_SEPARATOR.split(s);","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java#L108-L144","documentation":"ParameterizedFastPathStrategy.WeightDc.validateDC rejects a datacenter name in the accord fast_path 'dcs' option that is empty after trimming, throwing a ConfigurationException ('dc name must not be empty'). The dcs option is a comma-separated list of <dc>[:<weight>] entries used to weight Accord fast-path electorate selection.","triggerScenarios":"Configuring a keyspace/table fast_path parameterized strategy with a dcs string containing an empty DC entry, e.g. 'dcs=,dc1' or 'dc1:2,,dc2', so fromString -> validateDC receives ''.","commonSituations":"Trailing or double commas when hand-writing the dcs list in a CREATE/ALTER keyspace option or cassandra.yaml-like config; copy-paste with a lost DC name; generated config with empty variable for the DC name.","solutions":["Remove stray commas so the dcs list contains only non-empty entries, e.g. dcs=dc1:1,dc2:2","Verify each DC name matches an actual datacenter defined in the cluster (use nodetool describecluster/describecluster datacenters)","Re-run the CREATE/ALTER statement with the corrected dcs value"],"exampleFix":"// before\nALTER KEYSPACE ks WITH options = {fast_path: {'size':'4', 'dcs':'dc1:1,,dc3'}}\n\n// after\nALTER KEYSPACE ks WITH options = {fast_path: {'size':'4', 'dcs':'dc1:1,dc3'}}","handlingStrategy":"validation","validationCode":"String dcs = \"dc1:1,dc2\";\nList<String> bad = java.util.Arrays.stream(dcs.split(\",\"))\n    .map(String::trim).filter(String::isEmpty).collect(java.util.stream.Collectors.toList());\nif (!bad.isEmpty()) throw new IllegalArgumentException(\"dcs contains empty entries; fix commas\");","typeGuard":null,"tryCatchPattern":"try { applyFastPathOption(opts); } catch (org.apache.cassandra.exceptions.ConfigurationException e) {\n    if (e.getMessage().contains(\"must not be empty\"))\n        log.error(\"Remove empty dc entries from the dcs list\");\n}","preventionTips":["Join DC names programmatically instead of hand-writing the comma list","Never build the list from possibly-empty variables without filtering","Keep DC names matching real datacenters defined in the cluster","Lint option strings with a split(',')+trim check before applying"],"tags":["cassandra","accord","configuration","datacenter"],"backgroundTag":"empty-required-field","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"}