risingwavelabs/risingwave · error · ParallelismStrategyParseError
Invalid value for Ratio strategy: must be between 0.0 and 1.
Error message
Invalid value for Ratio strategy: must be between 0.0 and 1.0
What it means
ParallelismStrategyParseError::InvalidRatioValue is thrown when the float argument to the Ratio parallelism strategy parses but is outside the valid range [0.0, 1.0]. Ratio expresses a target fraction of current parallelism, so values like 1.5 or -0.1 are semantically meaningless and rejected with this fixed message.
Source
Thrown at src/common/src/system_param/adaptive_parallelism_strategy.rs:76
val.to_string()
}
}
#[derive(Error, Debug)]
pub enum ParallelismStrategyParseError {
#[error("Unsupported strategy: {0}")]
UnsupportedStrategy(String),
#[error("Parse error: {0}")]
ParseIntError(#[from] std::num::ParseIntError),
#[error("Parse error: {0}")]
ParseFloatError(#[from] std::num::ParseFloatError),
#[error("Invalid value for Bounded strategy: must be positive integer")]
InvalidBoundedValue,
#[error("Invalid value for Ratio strategy: must be between 0.0 and 1.0")]
InvalidRatioValue,
}
impl AdaptiveParallelismStrategy {
pub fn compute_target_parallelism(&self, current_parallelism: usize) -> usize {
match self {
AdaptiveParallelismStrategy::Auto | AdaptiveParallelismStrategy::Full => {
current_parallelism
}
AdaptiveParallelismStrategy::Bounded(n) => min(n.get(), current_parallelism),
AdaptiveParallelismStrategy::Ratio(r) => {
max((current_parallelism as f32 * r).floor() as usize, 1)
}
}
}
}
pub fn parse_strategy(View on GitHub (pinned to 6469eb736d)
Solutions
- Clamp the value to [0.0, 1.0] and re-set, e.g. 'ratio(0.5)'.
- Convert percentages to fractions before setting (50% -> 0.5).
- For target parallelism greater than current, use 'bounded(n)' or 'auto' instead of ratio.
Example fix
// before SET adaptive_parallelism_strategy = 'ratio(1.5)'; // after SET adaptive_parallelism_strategy = 'ratio(0.5)';
Defensive patterns
Strategy: validation
Validate before calling
// Clamp/validate ratio into [0.0, 1.0] before setting
fn set_ratio(r: f32) -> Result<String, String> {
if !(0.0..=1.0).contains(&r) {
return Err(format!("ratio {r} outside [0.0, 1.0]"));
}
Ok(format!("ratio({r})"))
} Try / catch
match result {
Err(ParallelismStrategyParseError::InvalidRatioValue) => {
eprintln!("ratio must be between 0.0 and 1.0 (convert percentages to fractions)");
}
other => other?,
} Prevention
- Always convert percentages to fractions before configuring.
- Clamp user-supplied values with r.clamp(0.0, 1.0) in tooling.
- Remember ratio targets a fraction of current parallelism; use bounded(n) for scale-up targets.
When it happens
Trigger: Setting the adaptive parallelism strategy to 'ratio(1.5)' or 'ratio(-0.1)' — a valid float that violates the 0.0 <= value <= 1.0 range check.
Common situations: Using a percentage number directly (ratio(50) instead of ratio(0.5)); thinking ratio is a multiplier > 1; sign errors in computed values.
Related errors
- Invalid value for Bounded strategy: must be positive integer
- unrecognized configs: {:?}
- Unsupported parallelism: {0}
- Parse error: {0}
- Unsupported strategy: {0}
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/05c5bef2d792530b.
Report an issue: GitHub.