apache/cassandra · error · java.lang.IllegalArgumentException
Threshold value for gc_warn_threshold
Error message
Threshold value for gc_warn_threshold (%d) must be greater than gc_log_threshold which is currently %d
What it means
setGCWarnThreshold enforces that gc_warn_threshold is strictly greater than the current gc_log_threshold whenever the warn threshold is non-zero. Setting it equal to or below gc_log_threshold is rejected because the warn threshold must fire before the log threshold.
Solutions
- Raise gc_warn_threshold so it is strictly greater than getGCLogThreshold()
- Lower gc_log_threshold first via setGCLogThreshold before setting the warn threshold
- Set gc_warn_threshold to 0 to disable it
- Reorder calls: set the log threshold after the warn threshold
Example fix
// before DatabaseDescriptor.setGCLogThreshold(20000); DatabaseDescriptor.setGCWarnThreshold(10000); // throws // after DatabaseDescriptor.setGCWarnThreshold(30000); DatabaseDescriptor.setGCLogThreshold(20000);
Defensive patterns
Strategy: validation
Validate before calling
if (warnMs != 0 && warnMs <= DatabaseDescriptor.getGCLogThreshold()) throw new IllegalArgumentException("gc_warn_threshold must exceed gc_log_threshold"); Try / catch
try { DatabaseDescriptor.setGCWarnThreshold(warn); } catch (IllegalArgumentException e) { logger.error("gc threshold ordering violated: {}", e.getMessage()); } Prevention
- Always set the warn threshold before the log threshold
- Read current values with getGCLogThreshold() before updating
- Keep gc_warn_threshold > gc_log_threshold > 0 in cassandra.yaml
When it happens
Trigger: Calling setGCWarnThreshold(threshold) where threshold != 0 and threshold <= DatabaseDescriptor.getGCLogThreshold(); e.g. setting warn=10000ms while gc_log_threshold is 20000ms.
Common situations: Editing cassandra.yaml so gc_warn_threshold ends up lower than gc_log_threshold, or updating one threshold programmatically without reordering both.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Threshold value for gc_concurrent_phase_log_threshold
- Threshold value for gc_concurrent_phase_warn_threshold
- Threshold must be greater than 0
- Threshold must be less than Integer.MAX_VALUE
- Threshold value for gc_concurrent_phase_warn_threshold must…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/b4b8a66572f76f12.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:5048
}
public static long getGCWarnThreshold()
{
return conf.gc_warn_threshold.toMilliseconds();
}
public static void setGCWarnThreshold(long threshold)
{
if (threshold < 0)
throw new IllegalArgumentException("Threshold value for gc_warn_threshold must be greater than or equal to 0");
if (threshold > Integer.MAX_VALUE)
throw new IllegalArgumentException("Threshold must be less than Integer.MAX_VALUE");
long gcLogThresholdInMs = getGCLogThreshold();
if (threshold != 0 && threshold <= gcLogThresholdInMs)
throw new IllegalArgumentException("Threshold value for gc_warn_threshold (" + threshold + ") must be greater than gc_log_threshold which is currently "
+ gcLogThresholdInMs);
conf.gc_warn_threshold = new DurationSpec.IntMillisecondsBound(threshold);
}
public static int getGCConcurrentPhaseLogThreshold()
{
return conf.gc_concurrent_phase_log_threshold.toMilliseconds();
}
public static void setGCConcurrentPhaseLogThreshold(int threshold)
{
if (threshold <= 0)
throw new IllegalArgumentException("Threshold must be greater than 0");
long gcConcurrentPhaseWarnThresholdInMs = getGCConcurrentPhaseWarnThreshold();
if (gcConcurrentPhaseWarnThresholdInMs != 0 && threshold > gcConcurrentPhaseWarnThresholdInMs)
throw new IllegalArgumentException("Threshold value for gc_concurrent_phase_log_threshold (" + threshold + ") must be less than gc_concurrent_phase_warn_threshold which is currently "View on GitHub (pinned to 88fd0f6a0e)