{"record":{"id":"9184e23f55c4a3c1","repo":"apache/cassandra","slug":"s-entries-must-not-be-empty","errorCode":null,"errorMessage":"%s entries must not be empty","messagePattern":"(.+?) entries must not be empty","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java","lineNumber":142,"sourceCode":"            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);\n            if (parts.length == 1)\n                return new WeightedDc(validateDC(parts[0]), idx, true);\n            else if (parts.length == 2)\n                return new WeightedDc(validateDC(parts[0]), validateWeight(parts[1]), false);\n            else\n                throw cfe(\"Invalid dc weighting syntax %s, use <dc>:<weight>\", s);\n        }\n    }\n\n    public final int size;\n    private final ImmutableMap<String, WeightedDc> dcs;\n\n    ParameterizedFastPathStrategy(int size, ImmutableMap<String, WeightedDc> dcs)\n    {\n        this.size = size;\n        this.dcs = dcs;","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java#L124-L160","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Remove empty items from the comma-separated dcs list before applying the config","Validate the dcs string with a quick split(',') check that every element is non-blank","Re-run the statement with a clean list like dcs=dc1,dc2:2"],"exampleFix":"// before\n'dcs':'dc1,,dc2:3,'\n\n// after\n'dcs':'dc1,dc2:3'","handlingStrategy":"validation","validationCode":"List<String> entries = java.util.Arrays.stream(dcs.split(\",\")).map(String::trim).collect(java.util.stream.Collectors.toList());\nif (entries.stream().anyMatch(String::isEmpty))\n    throw new IllegalArgumentException(\"dcs has empty entries: \" + dcs);","typeGuard":null,"tryCatchPattern":"try { applyFastPathOption(opts); } catch (org.apache.cassandra.exceptions.ConfigurationException e) {\n    if (e.getMessage().contains(\"entries must not be empty\"))\n        log.error(\"Strip empty items (extra/trailing commas) from dcs\");\n}","preventionTips":["Generate the dcs string from a validated collection with String.join(\",\", list)","Reject user input containing ',,' or leading/trailing commas","Trim entries before joining","Add a config linter for fast_path option maps"],"tags":["cassandra","accord","configuration","parsing"],"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-17T15:17:12.973Z"}