apache/cassandra · error · ConfigurationException
Cannot mix auto and manual DC weights
Error message
Cannot mix auto and manual DC weights
What it means
Each DC entry in 'dcs' either has an explicit weight (manual) or uses an automatic weight. The parser tracks hasAuto/hasManual flags and rejects a list that mixes automatic and manually weighted DCs, because the two sizing semantics are incompatible within one strategy.
Solutions
- Give every DC an explicit weight (e.g. "dc1=1.0,dc2=2.0") for fully manual weighting
- Remove all '=weight' suffixes for fully automatic weighting
- Split strategies if different DCs genuinely need different semantics — one strategy cannot mix them
Example fix
// before
Map<String,String> opts = Map.of("dcs", "dc1=0.5,dc2");
ParameterizedFastPathStrategy.fromMap(opts); // throws
// after
Map<String,String> opts = Map.of("dcs", "dc1=0.5,dc2=1.0");
ParameterizedFastPathStrategy.fromMap(opts); // ok Defensive patterns
Strategy: validation
Validate before calling
long weighted = dcsList.stream().filter(s -> s.contains("=")).count();
if (weighted != 0 && weighted != dcsList.size())
throw new IllegalArgumentException("all DCs must be either weighted or unweighted"); Prevention
- Pick one weighting model (all-auto or all-manual) per strategy
- When adding a DC to an existing list, match the weighting style of existing entries
When it happens
Trigger: Calling fromMap() with a dcs string combining weighted and unweighted entries, e.g. {"dcs": "dc1=0.5,dc2"} — a manual entry followed by an auto entry.
Common situations: Adding a new DC with explicit weight to an existing list of unweighted DCs (or vice versa); partial migration from auto weighting to manual weights during an operational change.
Related errors
- Concurrent accord operations must be non-negative
- DC weights must be zero or positive
- Invalid accord progress log configuration:
- must be a positive number, got
- must be greater than zero
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/11af310d44356db7.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java:278
if (map.containsKey(DCS) && !map.get(DCS).isEmpty())
{
Map<String, WeightedDc> mutableDcs = new HashMap<>();
String dcsString = map.get(DCS);
if (dcsString.trim().isEmpty())
throw cfe("%s must specify at least one DC", DCS);
int autoIdx = 0;
boolean hasAuto = false;
boolean hasManual = false;
for (String dcString : COMMA_SEPARATOR.split(dcsString))
{
WeightedDc dc = WeightedDc.fromString(dcString, autoIdx++);
if (mutableDcs.containsKey(dc.name))
throw cfe("Multiple entries for DC %s", dc.name);
if (dc.autoWeight)
{
if (hasManual) throw cfe("Cannot mix auto and manual DC weights");
hasAuto = true;
}
else
{
if (hasAuto) throw cfe("Cannot mix auto and manual DC weights");
hasManual = true;
}
mutableDcs.put(dc.name, dc);
}
dcMap = ImmutableMap.copyOf(mutableDcs);
}
else
{
dcMap = ImmutableMap.of();
}
Set<String> keys = new HashSet<>(map.keySet());View on GitHub (pinned to 88fd0f6a0e)