{"record":{"id":"188292acaa1fd0cd","repo":"apache/cassandra","slug":"the-warn-threshold-d-for-s-warn-threshold-should-188292","errorCode":null,"errorMessage":"The warn threshold %d for %s_warn_threshold should be greater than the fail threshold %d","messagePattern":"The warn threshold (.+?) for (.+?)_warn_threshold should be greater than the fail threshold (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/GuardrailsOptions.java","lineNumber":1596,"sourceCode":"    }\n\n    private static void validateWarnLowerThanFail(long warn, long fail, String name)\n    {\n        if (warn == -1 || fail == -1)\n            return;\n\n        if (fail < warn)\n            throw new IllegalArgumentException(format(\"The warn threshold %d for %s_warn_threshold should be lower \" +\n                                                      \"than the fail threshold %d\", warn, name, fail));\n    }\n\n    private static void validateWarnGreaterThanFail(long warn, long fail, String name)\n    {\n        if (warn == -1 || fail == -1)\n            return;\n\n        if (fail > warn)\n            throw new IllegalArgumentException(format(\"The warn threshold %d for %s_warn_threshold should be greater \" +\n                                                      \"than the fail threshold %d\", warn, name, fail));\n    }\n\n    /**\n     * A {@code null} size disables a size threshold, and a size of zero bytes is a valid threshold meaning \"any\n     * value above zero bytes triggers the guardrail\", so the only thing left to check is the relative order of the\n     * two thresholds. {@link DataStorageSpec} already rejects negative sizes when parsing.\n     */\n    private static void validateSizeThreshold(DataStorageSpec.LongBytesBound warn, DataStorageSpec.LongBytesBound fail, String name)\n    {\n        validateWarnLowerThanFail(warn, fail, name);\n    }\n\n    private static void validateWarnLowerThanFail(DataStorageSpec.LongBytesBound warn, DataStorageSpec.LongBytesBound fail, String name)\n    {\n        if (warn == null || fail == null)\n            return;\n","sourceCodeStart":1578,"sourceCodeEnd":1614,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/GuardrailsOptions.java#L1578-L1614","documentation":"For 'min-style' guardrails (where lower is worse, e.g. minimum_replication_factor), the warn threshold must be greater than (or equal to) the fail threshold. validateWarnGreaterThanFail() throws IllegalArgumentException when fail > warn, unless either threshold is -1 (disabled).","triggerScenarios":"Configuring a min-type guardrail such as minimum_replication_factor with warn < fail, e.g. 'minimum_replication_factor_warn_threshold: 2' with 'minimum_replication_factor_fail_threshold: 4'; validation runs at startup and on live guardrail updates.","commonSituations":"Reusing a max-guardrail template (warn < fail) for a min-guardrail where ordering is inverted; hand edits lowering the warn threshold below the fail threshold while tuning.","solutions":["Set the warn threshold >= the fail threshold (warnings fire before hard failures as the value drops).","Set one of the thresholds to -1 to disable that side.","Confirm which guardrail family (min vs max) you are configuring and apply the correct ordering."],"exampleFix":"// before\nminimum_replication_factor_warn_threshold: 2\nminimum_replication_factor_fail_threshold: 4\n// after\nminimum_replication_factor_warn_threshold: 4\nminimum_replication_factor_fail_threshold: 2","handlingStrategy":"validation","validationCode":"if (warn != -1 && fail != -1 && fail > warn) throw new IllegalArgumentException(\"for min-style guardrails warn (\" + warn + \") must be >= fail (\" + fail + \")\");","typeGuard":null,"tryCatchPattern":"try { validateMinThresholdPair(warn, fail); } catch (IllegalArgumentException e) { log.error(\"Min-guardrail thresholds inverted: {}\", e.getMessage()); throw e; }","preventionTips":["Do not reuse max-guardrail templates for min-guardrails; ordering is inverted.","Lint min_* guardrails so warn >= fail.","Use -1 to disable a side rather than reordering thresholds."],"tags":["config","guardrails","thresholds","cassandra"],"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-14T16:17:12.679Z"}