apache/cassandra · error · java.lang.IllegalArgumentException
Threshold value for gc_concurrent_phase_warn_threshold must…
Error message
Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0
What it means
setGCConcurrentPhaseWarnThreshold rejects negative values. The warn threshold (in ms) must be >= 0, where 0 disables it; negative ints indicate a bad config or conversion bug and throw IllegalArgumentException.
Solutions
- Pass a non-negative threshold (0 disables the warning)
- Fix negative values in cassandra.yaml
- Check for integer overflow in unit conversion code before calling
Example fix
// before DatabaseDescriptor.setGCConcurrentPhaseWarnThreshold(-500); // after DatabaseDescriptor.setGCConcurrentPhaseWarnThreshold(0); // or a positive ms value
Defensive patterns
Strategy: validation
Validate before calling
if (threshold < 0) throw new IllegalArgumentException("gc_concurrent_phase_warn_threshold must be >= 0"); Try / catch
try { DatabaseDescriptor.setGCConcurrentPhaseWarnThreshold(v); } catch (IllegalArgumentException e) { logger.error("invalid gc_concurrent_phase_warn_threshold: {}", e.getMessage()); } Prevention
- Use 0, never a negative number, to disable the warn threshold
- Check for int overflow when converting time units
- Validate durations in cassandra.yaml are non-negative
When it happens
Trigger: Calling setGCConcurrentPhaseWarnThreshold with a negative int, e.g. from an int overflow after unit conversion or a typo like -1000 in cassandra.yaml.
Common situations: Overflow when converting larger time units to ms, or hand-edited config with a negative duration.
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 must be greater than 0
- Threshold must be less than Integer.MAX_VALUE
- Threshold value for gc_concurrent_phase_log_threshold
- Threshold value for gc_concurrent_phase_warn_threshold
- Threshold value for gc_warn_threshold
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/7b44287f93a90200.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:5080
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 "
+ gcConcurrentPhaseWarnThresholdInMs);
conf.gc_concurrent_phase_log_threshold = new DurationSpec.IntMillisecondsBound(threshold);
}
public static int getGCConcurrentPhaseWarnThreshold()
{
return conf.gc_concurrent_phase_warn_threshold.toMilliseconds();
}
public static void setGCConcurrentPhaseWarnThreshold(int threshold)
{
if (threshold < 0)
throw new IllegalArgumentException("Threshold value for gc_concurrent_phase_warn_threshold must be greater than or equal to 0");
long gcConcurrentPhaseLogThresholdInMs = getGCConcurrentPhaseLogThreshold();
if (threshold != 0 && threshold <= gcConcurrentPhaseLogThresholdInMs)
throw new IllegalArgumentException("Threshold value for gc_concurrent_phase_warn_threshold (" + threshold + ") must be greater than gc_concurrent_phase_log_threshold which is currently "
+ gcConcurrentPhaseLogThresholdInMs);
conf.gc_concurrent_phase_warn_threshold = new DurationSpec.IntMillisecondsBound(threshold);
}
public static boolean isCDCEnabled()
{
return conf.cdc_enabled;
}
@VisibleForTesting
public static void setCDCEnabled(boolean cdc_enabled)
{
conf.cdc_enabled = cdc_enabled;View on GitHub (pinned to 88fd0f6a0e)