{"record":{"id":"49ee801ab3867aba","repo":"apache/cassandra","slug":"can-not-parse-replication-factor-s","errorCode":null,"errorMessage":"Can not parse replication factor %s","messagePattern":"Can not parse replication factor (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/CMSAdmin.java","lineNumber":188,"sourceCode":"                    if (args.size() > 1)\n                        throw new IllegalArgumentException(\"Simple placement can only specify a single replication factor across all data centers\");\n                    int parsedRf;\n                    try\n                    {\n                        parsedRf = Integer.parseInt(args.get(0));\n                    }\n                    catch (Throwable t)\n                    {\n                        throw new IllegalArgumentException(String.format(\"Can not parse replication factor from %s\", args.get(0)));\n                    }\n                    probe.getCMSOperationsProxy().reconfigureCMS(parsedRf);\n                    return;\n                }\n                else\n                {\n                    String[] splits = rf.split(\":\");\n                    if (splits.length > 2)\n                        throw new IllegalArgumentException(String.format(\"Can not parse replication factor %s\", rf));\n                    String dc = splits[0];\n                    int parsedRf;\n                    try\n                    {\n                        parsedRf = Integer.parseInt(splits[1]);\n                    }\n                    catch (Throwable t)\n                    {\n                        throw new IllegalArgumentException(String.format(\"Can not parse replication factor from %s\", args.get(0)));\n                    }\n                    parsedRfs.put(dc, parsedRf);\n                }\n            }\n\n            probe.getCMSOperationsProxy().reconfigureCMS(parsedRfs);\n        }\n    }\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/CMSAdmin.java#L170-L206","documentation":"Nodetool's CMSAdmin (nodetool cms reconfigure) accepts replication factors of the form 'dc:rf'. If the argument contains more than one colon (more than 2 splits), it cannot be interpreted as a datacenter:replication-factor pair, so an IllegalArgumentException is thrown before any cluster operation starts.","triggerScenarios":"Running `nodetool cms reconfigure` with an RF argument containing multiple colons, e.g. `nodetool cms reconfigure dc1:5:extra` or a stray quoted string with colons.","commonSituations":"Typos when specifying per-DC RFs, accidentally passing a full option string, or pasting config snippets containing 'keyspace:dc:rf'-style values instead of the expected 'dc:rf' pair.","solutions":["Pass replication factors as separate dc:rf pairs, e.g. `nodetool cms reconfigure dc1:3 dc2:5`, not a single colon-heavy string","Quote arguments correctly in the shell so stray colons from variables are not concatenated","Check `nodetool describecluster` for the actual DC names and format each as dc:integer"],"exampleFix":"// before\nnodetool cms reconfigure \"dc1:3:dc2:5\"\n// after\nnodetool cms reconfigure dc1:3 dc2:5","handlingStrategy":"validation","validationCode":"String rf = args.get(0);\nString[] splits = rf.split(\":\");\nif (splits.length > 2 || splits.length < 2)\n    throw new IllegalArgumentException(\"expected dc:rf, got \" + rf);\nInteger.parseInt(splits[1]); // fail fast","typeGuard":null,"tryCatchPattern":"try { probe.getCMSOperationsProxy().reconfigureCMS(parsedRfs); }\ncatch (IllegalArgumentException e) { System.err.println(\"Bad RF spec: \" + e.getMessage()); }","preventionTips":["Always pass dc:rf pairs, one per argument","Quote shell variables to avoid unintended concatenation","Verify DC names with nodetool describecluster"],"tags":["nodetool","cli","validation","replication"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}