apache/cassandra · error · ConfigurationException
dc name must not be empty
Error message
dc name must not be empty
What it means
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.
Source
Thrown at src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java:126
@Override
public int compareTo(@Nonnull WeightedDc that)
{
int cmp = Integer.compare(this.weight, that.weight);
if (cmp != 0) return cmp;
return this.name.compareTo(that.name);
}
public String toString()
{
return autoWeight ? name : name + ':' + weight;
}
static String validateDC(String dc)
{
dc = dc.trim();
if (dc.isEmpty())
throw cfe("dc name must not be empty", DCS);
return dc;
}
static int validateWeight(String w)
{
int weight = Integer.parseInt(w);
if (weight < 0)
throw cfe("DC weights must be zero or positive");
return weight;
}
static WeightedDc fromString(String s, int idx)
{
s = s.trim();
if (s.isEmpty())
throw cfe("%s entries must not be empty", DCS);
String[] parts = COLON_SEPARATOR.split(s);View on GitHub (pinned to 88fd0f6a0e)
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
Example fix
// before
ALTER KEYSPACE ks WITH options = {fast_path: {'size':'4', 'dcs':'dc1:1,,dc3'}}
// after
ALTER KEYSPACE ks WITH options = {fast_path: {'size':'4', 'dcs':'dc1:1,dc3'}} Defensive patterns
Strategy: validation
Validate before calling
String dcs = "dc1:1,dc2";
List<String> bad = java.util.Arrays.stream(dcs.split(","))
.map(String::trim).filter(String::isEmpty).collect(java.util.stream.Collectors.toList());
if (!bad.isEmpty()) throw new IllegalArgumentException("dcs contains empty entries; fix commas"); Try / catch
try { applyFastPathOption(opts); } catch (org.apache.cassandra.exceptions.ConfigurationException e) {
if (e.getMessage().contains("must not be empty"))
log.error("Remove empty dc entries from the dcs list");
} Prevention
- 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
When it happens
Trigger: 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 ''.
Common situations: 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.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- accord.journal_directory must not be the same as any data_fi
- accord.cache_size option was set incorrectly to '<value>', s
- the local data center must be part of the repair; requested
- No accord transaction should be executed when accord.enabled
- Cannot change transactional mode to %s for %s.%s with accord
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/1237ad3e56e480ed.
Report an issue: GitHub.