apache/cassandra · error · java.lang.IllegalArgumentException
Value must be >= 0 and <= 1 for repair_disk_headroom_reject_
Error message
Value must be >= 0 and <= 1 for repair_disk_headroom_reject_ratio
What it means
setRepairDiskHeadroomRejectRatio validates that the repair disk headroom ratio is a fraction in [0.0, 1.0] before storing it. Values outside this range are not meaningful as a disk-usage rejection ratio, so the setter throws IllegalArgumentException.
Source
Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:6501
{
return conf.accord.ephemeral_reads;
}
public static AutoRepairConfig getAutoRepairConfig()
{
return conf.auto_repair;
}
public static double getRepairDiskHeadroomRejectRatio()
{
return conf.repair_disk_headroom_reject_ratio;
}
public static void setRepairDiskHeadroomRejectRatio(double value)
{
if (value < 0.0 || value > 1.0)
{
throw new IllegalArgumentException("Value must be >= 0 and <= 1 for repair_disk_headroom_reject_ratio");
}
conf.repair_disk_headroom_reject_ratio = value;
}
@VisibleForTesting
public static void setPartitioner(String name)
{
partitioner = FBUtilities.newPartitioner(name);
}
public static boolean getGossipQuarantineDisabled()
{
return conf.gossip_quarantine_disabled;
}
public static void setGossipQuarantineDisabled(boolean disabled)
{
conf.gossip_quarantine_disabled = disabled;View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Pass a value between 0.0 and 1.0 inclusive (e.g. 0.2 for 20% headroom).
- Convert percentage-style values by dividing by 100 before setting.
- Correct repair_disk_headroom_reject_ratio in cassandra.yaml.
Example fix
// before DatabaseDescriptor.setRepairDiskHeadroomRejectRatio(20); // after DatabaseDescriptor.setRepairDiskHeadroomRejectRatio(0.20);
Defensive patterns
Strategy: validation
Validate before calling
if (ratio >= 0.0 && ratio <= 1.0) DatabaseDescriptor.setRepairDiskHeadroomRejectRatio(ratio);
Type guard
boolean isValidHeadroomRatio(double r) { return r >= 0.0 && r <= 1.0; } Try / catch
try { DatabaseDescriptor.setRepairDiskHeadroomRejectRatio(ratio); } catch (IllegalArgumentException e) { log.error("bad repair_disk_headroom_reject_ratio", e); } Prevention
- Express headroom as a fraction (0.2), not a percentage (20).
- Clamp parsed values into [0,1] from YAML/scripts.
- Document the expected range in config templates.
When it happens
Trigger: Calling DatabaseDescriptor.setRepairDiskHeadroomRejectRatio with a double < 0.0 or > 1.0, e.g. 1.5 or -0.1, via code, JMX, or a misconfigured repair_disk_headroom_reject_ratio value.
Common situations: Operators entering the ratio as a percentage (e.g. 20 instead of 0.2); YAML values parsed as whole numbers; scripts computing the ratio incorrectly yielding negatives.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Cannot set repair_session_max_tree_depth to which is < 10, d
- Cannot set concurrent_validations greater than concurrent_co
- Invalid data rate: value must be non-negative
- Invalid data storage: %s Accepted units:%s
- repair_session_max_tree_depth should not be < 10, but was ${
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/cbc29a1ae622dcbf.
Report an issue: GitHub.