{"record":{"id":"0e92c658b586b8ce","repo":"apache/cassandra","slug":"multiple-entries-for-dc-s","errorCode":null,"errorMessage":"Multiple entries for DC %s","messagePattern":"Multiple entries for DC (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java","lineNumber":274,"sourceCode":"        if (size < 1)\n            throw cfe(\"%s must be greater than zero\", SIZE);\n\n        ImmutableMap<String, WeightedDc> dcMap;\n        if (map.containsKey(DCS) && !map.get(DCS).isEmpty())\n        {\n            Map<String, WeightedDc> mutableDcs = new HashMap<>();\n            String dcsString = map.get(DCS);\n            if (dcsString.trim().isEmpty())\n                throw cfe(\"%s must specify at least one DC\", DCS);\n\n            int autoIdx = 0;\n            boolean hasAuto = false;\n            boolean hasManual = false;\n            for (String dcString : COMMA_SEPARATOR.split(dcsString))\n            {\n                WeightedDc dc = WeightedDc.fromString(dcString, autoIdx++);\n                if (mutableDcs.containsKey(dc.name))\n                    throw cfe(\"Multiple entries for DC %s\", dc.name);\n\n                if (dc.autoWeight)\n                {\n                    if (hasManual) throw cfe(\"Cannot mix auto and manual DC weights\");\n                    hasAuto = true;\n                }\n                else\n                {\n                    if (hasAuto) throw cfe(\"Cannot mix auto and manual DC weights\");\n                    hasManual = true;\n                }\n\n                mutableDcs.put(dc.name, dc);\n            }\n            dcMap = ImmutableMap.copyOf(mutableDcs);\n        }\n        else\n        {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java#L256-L292","documentation":"When splitting the 'dcs' option on commas, each entry is parsed into a WeightedDc and inserted into a map keyed by DC name. If the same DC name appears more than once, the duplicate insertion is rejected with a ConfigurationException instead of silently overwriting.","triggerScenarios":"Calling fromMap() with {\"dcs\": \"dc1,dc1\"} or case/format variants that parse to the same name, e.g. \"dc1:auto,dc1=0.5\".","commonSituations":"Appending a DC to an existing list without noticing it was already present; scripted config generation concatenating overlapping DC sets; inconsistent casing across entries.","solutions":["Remove duplicate entries from the 'dcs' list so each DC appears once","Normalize DC casing before building the list (e.g. all lowercase)","Deduplicate in tooling that generates the dcs string from multiple sources"],"exampleFix":"// before\nMap<String,String> opts = Map.of(\"dcs\", \"dc1,dc1=0.5\");\nParameterizedFastPathStrategy.fromMap(opts); // throws\n// after\nMap<String,String> opts = Map.of(\"dcs\", \"dc1=0.5\");\nParameterizedFastPathStrategy.fromMap(opts); // ok","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (String dc : dcsString.split(\",\")) {\n    if (!seen.add(dc.trim()))\n        throw new IllegalArgumentException(\"duplicate DC entry: \" + dc);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate DC lists at config-generation time","Normalize DC name casing consistently across the cluster"],"tags":["configuration","duplicate","accord"],"backgroundTag":"conflicting-config-options","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"}