apache/cassandra · error · java.lang.IllegalArgumentException

denylist_refresh must be a positive integer.

Error message

denylist_refresh must be a positive integer.

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:5536

    public static boolean getDenylistRangeReadsEnabled()
    {
        return conf.denylist_range_reads_enabled;
    }

    public static void setDenylistRangeReadsEnabled(boolean enabled)
    {
        conf.denylist_range_reads_enabled = enabled;
    }

    public static int getDenylistRefreshSeconds()
    {
        return conf.denylist_refresh.toSeconds();
    }

    public static void setDenylistRefreshSeconds(int seconds)
    {
        if (seconds <= 0)
            throw new IllegalArgumentException("denylist_refresh must be a positive integer.");

        conf.denylist_refresh = new DurationSpec.IntSecondsBound(seconds);
    }

    public static int getDenylistInitialLoadRetrySeconds()
    {
        return conf.denylist_initial_load_retry.toSeconds();
    }

    public static void setDenylistInitialLoadRetrySeconds(int seconds)
    {
        if (seconds <= 0)
            throw new IllegalArgumentException("denylist_initial_load_retry must be a positive integer.");

        conf.denylist_initial_load_retry = new DurationSpec.IntSecondsBound(seconds);
    }

    public static ConsistencyLevel getDenylistConsistencyLevel()

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass a positive integer (>= 1 second)
  2. Remove the zero/negative value from cassandra.yaml and keep the default
  3. Guard the call site with seconds > 0 before invoking

Example fix

// before
DatabaseDescriptor.setDenylistRefreshSeconds(0);
// after
DatabaseDescriptor.setDenylistRefreshSeconds(60);
Defensive patterns

Strategy: validation

Validate before calling

if (seconds <= 0) throw new IllegalArgumentException("denylist_refresh must be a positive integer");

Try / catch

try { DatabaseDescriptor.setDenylistRefreshSeconds(v); } catch (IllegalArgumentException e) { logger.error("invalid denylist_refresh: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling setDenylistRefreshSeconds(0) or with a negative int; e.g. denylist_refresh: 0 in cassandra.yaml intending to disable refresh.

Common situations: Users set denylist_refresh: 0 expecting to disable periodic reload of the deny list; the setter forbids it.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/4e7b367ba6fff4a0. Report an issue: GitHub.