apache/cassandra · error · IllegalArgumentException

Threshold value for gc_log*_threshold must be greater than 0

Error message

Threshold value for gc_log*_threshold must be greater than 0

What it means

Cassandra throws this IllegalArgumentException from validateGCParams when the GC log threshold (gc_log_threshold in ms) is zero or negative. This threshold controls how long a GC pause must be before it is logged; it must be a positive value.

Source

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

    {
        conf.user_function_timeout_policy = userFunctionTimeoutPolicy;
    }

    public static long getGCLogThreshold()
    {
        return conf.gc_log_threshold.toMilliseconds();
    }

    public static void setGCLogThreshold(int threshold)
    {
        validateGCParams(threshold, getGCWarnThreshold());
        conf.gc_log_threshold = new DurationSpec.IntMillisecondsBound(threshold);
    }

    public static void validateGCParams(long logThreshold, long warnThreshold)
    {
        if (logThreshold <= 0)
            throw new IllegalArgumentException("Threshold value for gc_log*_threshold must be greater than 0");
        if (logThreshold > Integer.MAX_VALUE)
            throw new IllegalArgumentException("Threshold value for gc_log*_threshold must be less than Integer.MAX_VALUE");

        if (warnThreshold <= 0)
            throw new IllegalArgumentException("Threshold value for gc_warn*_threshold must be greater than 0");
        if (warnThreshold > Integer.MAX_VALUE)
            throw new IllegalArgumentException("Threshold value for gc_warn*_threshold must be less than Integer.MAX_VALUE");

        if (warnThreshold != 0 && logThreshold > warnThreshold)
            throw new IllegalArgumentException("Threshold value for gc_log*_threshold (" + logThreshold + ") must be less than gc_warn*_threshold which is currently "
                    + warnThreshold);
    }

    public static EncryptionContext getEncryptionContext()
    {
        return encryptionContext;

    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set gc_log_threshold to a positive millisecond value (e.g. 200)
  2. Check cassandra.yaml for gc_log_threshold and remove 0/negative values
  3. For JMX runtime updates, pass a positive long to the setter before re-validating

Example fix

// before (cassandra.yaml)
gc_log_threshold: 0ms
// after
gc_log_threshold: 200ms
Defensive patterns

Strategy: validation

Validate before calling

if (logThreshold <= 0 || logThreshold > Integer.MAX_VALUE)
    throw new IllegalArgumentException("gc_log_threshold must be > 0 and <= Integer.MAX_VALUE ms");

Try / catch

try {
    DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold);
} catch (IllegalArgumentException e) {
    logger.error("Invalid GC thresholds in cassandra.yaml", e);
    throw e; // fail fast before node startup proceeds
}

Prevention

When it happens

Trigger: Calling DatabaseDescriptor.validateGCParams(logThreshold, warnThreshold) with logThreshold <= 0; also triggered during startup when gc_log_threshold in cassandra.yaml is 0 or negative.

Common situations: Operators setting gc_log_threshold: 0 believing 0 disables GC logging, or typos like a leading minus sign in cassandra.yaml.

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/4e70727df7e77c57. Report an issue: GitHub.