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
- Set gc_log_threshold to a positive millisecond value (e.g. 200)
- Check cassandra.yaml for gc_log_threshold and remove 0/negative values
- 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
- Keep gc_log_threshold a positive ms value (default 200ms)
- Never use 0 thinking it disables logging
- Run validateGCParams on parsed config before startup
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
- Threshold value for gc_warn*_threshold must be greater than
- Threshold value for gc_log*_threshold (%d) must be less than
- Threshold value for gc_log*_threshold must be less than Inte
- Threshold value for gc_warn*_threshold must be less than Int
- Threshold value for gc_warn_threshold must be greater than o
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/4e70727df7e77c57.
Report an issue: GitHub.