{"record":{"id":"8c945f28ee29286a","repo":"apache/cassandra","slug":"invalid-value-d-for-s-minimum-allowed-value-is","errorCode":null,"errorMessage":"Invalid value %d for %s: minimum allowed value is 3, as CMS requires at least 3 replicas to maintain quorum safely. Use -1 to disable this guardrail","messagePattern":"Invalid value (.+?) for (.+?): minimum allowed value is 3, as CMS requires at least 3 replicas to maintain quorum safely\\. Use -1 to disable this guardrail","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/GuardrailsOptions.java","lineNumber":1563,"sourceCode":"    }\n\n    private static void validateMaxRFThreshold(int warn, int fail)\n    {\n        validateMaxIntThreshold(warn, fail, \"maximum_replication_factor\");\n\n        if (fail != -1 && fail < DatabaseDescriptor.getDefaultKeyspaceRF())\n            throw new IllegalArgumentException(format(\"maximum_replication_factor_fail_threshold to be set (%d) \" +\n                                                      \"cannot be lesser than default_keyspace_rf (%d)\",\n                                                      fail, DatabaseDescriptor.getDefaultKeyspaceRF()));\n    }\n\n    private static void validateMinCmsSizeThreshold(int value, String name)\n    {\n        if (value == -1)\n            return;\n\n        if (value < 3)\n            throw new IllegalArgumentException(format(\"Invalid value %d for %s: minimum allowed value is 3, \" +\n                                                      \"as CMS requires at least 3 replicas to maintain quorum safely. \" +\n                                                      \"Use -1 to disable this guardrail\", value, name));\n    }\n\n    public static void validateTimestampThreshold(DurationSpec.LongMicrosecondsBound warn,\n                                                  DurationSpec.LongMicrosecondsBound fail,\n                                                  String name)\n    {\n        // this function is used for both upper and lower thresholds because lower threshold is relative\n        // despite using MinThreshold we still want the warn threshold to be less than or equal to\n        // the fail threshold.\n        validateMaxLongThreshold(warn == null ? -1 : warn.toMicroseconds(),\n                                 fail == null ? -1 : fail.toMicroseconds(),\n                                 name);\n    }\n\n    private static void validateWarnLowerThanFail(long warn, long fail, String name)\n    {","sourceCodeStart":1545,"sourceCodeEnd":1581,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/GuardrailsOptions.java#L1545-L1581","documentation":"The CMS (Cluster Metadata Service) size guardrail thresholds must be at least 3, because CMS requires at least 3 replicas to maintain quorum safely. Values of 0, 1, or 2 are rejected by validateMinCmsSizeThreshold(); -1 (disable) is explicitly allowed.","triggerScenarios":"Setting a CMS-related guardrail threshold (e.g. cms_new_nodes_before_cleanup-related minimum thresholds, validateMinCmsSizeThreshold callers) to 0, 1 or 2 in cassandra.yaml or through a live config update.","commonSituations":"Operators setting the threshold to 0 or 1 thinking 0 means 'disabled' (for this guardrail disable is -1); single-node dev clusters being configured with CMS guardrail sizes of 1 and then copied to shared configs.","solutions":["Set the threshold to 3 or higher.","Use -1 if you intend to disable this guardrail (not 0).","If a script generates the value, clamp it: Math.max(3, requested) unless requested == -1."],"exampleFix":"// before\ncms_size_guardrail_threshold: 1\n// after\ncms_size_guardrail_threshold: 3\n// or to disable\ncms_size_guardrail_threshold: -1","handlingStrategy":"validation","validationCode":"int v = cmsSizeThreshold;\nif (v != -1 && v < 3) throw new IllegalArgumentException(\"CMS size guardrail must be >= 3 or -1 to disable, got \" + v);","typeGuard":null,"tryCatchPattern":"try { applyCmsGuardrail(v); } catch (IllegalArgumentException e) { log.error(\"CMS guardrail value invalid: {}\", e.getMessage()); throw e; }","preventionTips":["Do not use 0 to disable this guardrail; the disable sentinel is -1.","Clamp generated values to >= 3 unless they are -1.","Document quorum rationale (CMS needs >= 3 replicas) in your config templates."],"tags":["config","guardrails","cms","cassandra"],"backgroundTag":"value-out-of-range","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"}