apache/cassandra · error · ConfigurationException

entries must not be empty

Error message

%s entries must not be empty

What it means

WeightedDc.fromString rejects a dcs entry that is empty after trimming, throwing a ConfigurationException formatted as '<dcs> entries must not be empty'. Each comma-separated entry of the accord fast_path dcs option must name a datacenter, optionally with a colon-separated weight.

Solutions

  1. Remove empty items from the comma-separated dcs list before applying the config
  2. Validate the dcs string with a quick split(',') check that every element is non-blank
  3. Re-run the statement with a clean list like dcs=dc1,dc2:2

Example fix

// before
'dcs':'dc1,,dc2:3,'

// after
'dcs':'dc1,dc2:3'
Defensive patterns

Strategy: validation

Validate before calling

List<String> entries = java.util.Arrays.stream(dcs.split(",")).map(String::trim).collect(java.util.stream.Collectors.toList());
if (entries.stream().anyMatch(String::isEmpty))
    throw new IllegalArgumentException("dcs has empty entries: " + dcs);

Try / catch

try { applyFastPathOption(opts); } catch (org.apache.cassandra.exceptions.ConfigurationException e) {
    if (e.getMessage().contains("entries must not be empty"))
        log.error("Strip empty items (extra/trailing commas) from dcs");
}

Prevention

When it happens

Trigger: Calling ParameterizedFastPathStrategy.fromMap with a dcs map value containing empty list items, e.g. dcs='dc1:1,,dc2' or a string starting/ending with a comma after splitting.

Common situations: Hand-edited or template-generated dcs strings with consecutive commas; trimming/concatenation bugs in automation producing a trailing comma; whitespace-only entries between commas (whitespace-only entries pass the trim check as empty too).

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/9184e23f55c4a3c1. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java:142

            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);
            if (parts.length == 1)
                return new WeightedDc(validateDC(parts[0]), idx, true);
            else if (parts.length == 2)
                return new WeightedDc(validateDC(parts[0]), validateWeight(parts[1]), false);
            else
                throw cfe("Invalid dc weighting syntax %s, use <dc>:<weight>", s);
        }
    }

    public final int size;
    private final ImmutableMap<String, WeightedDc> dcs;

    ParameterizedFastPathStrategy(int size, ImmutableMap<String, WeightedDc> dcs)
    {
        this.size = size;
        this.dcs = dcs;

View on GitHub (pinned to 88fd0f6a0e)