{"record":{"id":"a9d7647574bd0507","repo":"apache/cassandra","slug":"the-warn-threshold-d-for-s-warn-threshold-should","errorCode":null,"errorMessage":"The warn threshold %d for %s_warn_threshold should be lower than the fail threshold %d","messagePattern":"The warn threshold (.+?) for (.+?)_warn_threshold should be lower than the fail threshold (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/GuardrailsOptions.java","lineNumber":1586,"sourceCode":"    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    {\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     */","sourceCodeStart":1568,"sourceCodeEnd":1604,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/GuardrailsOptions.java#L1568-L1604","documentation":"For 'max-style' guardrails (where higher is worse), the warn threshold must be lower than (or equal to) the fail threshold. validateWarnLowerThanFail() throws IllegalArgumentException when fail < warn, unless either threshold is -1 (disabled). Note the message wording swaps the displayed order: the first number shown is warn, the second is fail.","triggerScenarios":"Configuring any max-type guardrail pair like partition_size_in_mb, collection_size, percentage thresholds, or timestamp thresholds with warn > fail, e.g. 'some_warn_threshold: 1000' with 'some_fail_threshold: 500' in cassandra.yaml or via live update.","commonSituations":"Copy-paste swaps of the two values in cassandra.yaml; incrementing the warn threshold past the fail threshold during tuning; tools generating config that assumes warn-first ordering but assigns larger values to warn.","solutions":["Swap or adjust the two values so warn <= fail (warn fires earlier than fail).","Set one threshold to -1 if that side should be disabled.","Re-read the message carefully: first number is the warn threshold, second is the fail threshold."],"exampleFix":"// before\npartition_size_in_mb_warn_threshold: 1000\npartition_size_in_mb_fail_threshold: 500\n// after\npartition_size_in_mb_warn_threshold: 500\npartition_size_in_mb_fail_threshold: 1000","handlingStrategy":"validation","validationCode":"if (warn != -1 && fail != -1 && fail < warn) throw new IllegalArgumentException(\"warn (\" + warn + \") must be <= fail (\" + fail + \") for max-style guardrail\");","typeGuard":null,"tryCatchPattern":"try { validateThresholdPair(warn, fail); } catch (IllegalArgumentException e) { log.error(\"Guardrail thresholds inverted: {}\", e.getMessage()); throw e; }","preventionTips":["Keep a convention: warn values always written first and always <= fail for max-guardrails.","Add a yaml linter rule comparing each *_warn_threshold with its *_fail_threshold.","Never increment warn past fail during tuning without moving fail too."],"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"}