{"record":{"id":"4e7b367ba6fff4a0","repo":"apache/cassandra","slug":"denylist-refresh-must-be-a-positive-integer","errorCode":null,"errorMessage":"denylist_refresh must be a positive integer.","messagePattern":"denylist_refresh must be a positive integer\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":5536,"sourceCode":"    public static boolean getDenylistRangeReadsEnabled()\n    {\n        return conf.denylist_range_reads_enabled;\n    }\n\n    public static void setDenylistRangeReadsEnabled(boolean enabled)\n    {\n        conf.denylist_range_reads_enabled = enabled;\n    }\n\n    public static int getDenylistRefreshSeconds()\n    {\n        return conf.denylist_refresh.toSeconds();\n    }\n\n    public static void setDenylistRefreshSeconds(int seconds)\n    {\n        if (seconds <= 0)\n            throw new IllegalArgumentException(\"denylist_refresh must be a positive integer.\");\n\n        conf.denylist_refresh = new DurationSpec.IntSecondsBound(seconds);\n    }\n\n    public static int getDenylistInitialLoadRetrySeconds()\n    {\n        return conf.denylist_initial_load_retry.toSeconds();\n    }\n\n    public static void setDenylistInitialLoadRetrySeconds(int seconds)\n    {\n        if (seconds <= 0)\n            throw new IllegalArgumentException(\"denylist_initial_load_retry must be a positive integer.\");\n\n        conf.denylist_initial_load_retry = new DurationSpec.IntSecondsBound(seconds);\n    }\n\n    public static ConsistencyLevel getDenylistConsistencyLevel()","sourceCodeStart":5518,"sourceCodeEnd":5554,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L5518-L5554","documentation":"DatabaseDescriptor.setDenylistRefreshSeconds requires a strictly positive number of seconds for denylist_refresh. Zero or negative values are rejected with IllegalArgumentException because the refresh interval must be a real period.","triggerScenarios":"Calling setDenylistRefreshSeconds(0) or with a negative int; e.g. denylist_refresh: 0 in cassandra.yaml intending to disable refresh.","commonSituations":"Users set denylist_refresh: 0 expecting to disable periodic reload of the deny list; the setter forbids it.","solutions":["Pass a positive integer (>= 1 second)","Remove the zero/negative value from cassandra.yaml and keep the default","Guard the call site with seconds > 0 before invoking"],"exampleFix":"// before\nDatabaseDescriptor.setDenylistRefreshSeconds(0);\n// after\nDatabaseDescriptor.setDenylistRefreshSeconds(60);","handlingStrategy":"validation","validationCode":"if (seconds <= 0) throw new IllegalArgumentException(\"denylist_refresh must be a positive integer\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.setDenylistRefreshSeconds(v); } catch (IllegalArgumentException e) { logger.error(\"invalid denylist_refresh: {}\", e.getMessage()); }","preventionTips":["Never set denylist_refresh to 0 expecting a disable behavior","Validate positive durations when parsing cassandra.yaml","Keep defaults unless a positive interval is explicitly needed"],"tags":["config","validation","denylist"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}