risingwavelabs/risingwave · error · ParallelismStrategyParseError

Invalid value for Bounded strategy: must be positive integer

Error message

Invalid value for Bounded strategy: must be positive integer

What it means

ParallelismStrategyParseError::InvalidBoundedValue is thrown when the integer argument to the Bounded parallelism strategy parses but is not a positive (non-zero) value. The Bounded strategy requires a strictly positive integer target parallelism, so 'bounded(0)' (or a negative value where parseable) is rejected with this fixed message.

Source

Thrown at src/common/src/system_param/adaptive_parallelism_strategy.rs:73

impl From<AdaptiveParallelismStrategy> for String {
    fn from(val: AdaptiveParallelismStrategy) -> Self {
        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)
            }
        }
    }

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Use a strictly positive integer: 'bounded(1)' or higher.
  2. If you want automatic sizing rather than a fixed bound, use 'auto' or 'default' instead.
  3. Validate that any programmatically computed bound is > 0 before setting the parameter.

Example fix

// before
SET adaptive_parallelism_strategy = 'bounded(0)';
// after
SET adaptive_parallelism_strategy = 'bounded(1)';
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate bound positivity
fn set_bounded(n: u64) -> Result<String, String> {
    let n = std::num::NonZeroU64::new(n).ok_or("bounded requires n > 0")?;
    Ok(format!("bounded({})", n.get()))
}

Try / catch

match result {
    Err(ParallelismStrategyParseError::InvalidBoundedValue) => {
        eprintln!("bounded strategy requires a positive integer (>= 1)");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Setting the adaptive parallelism strategy to 'bounded(0)' or otherwise non-positive integer value — the parse succeeds as an integer but fails the positivity check before constructing NonZeroU64.

Common situations: Computing bounds from variables that can evaluate to 0; misunderstanding 'bounded' as an inclusive lower bound; copy-paste of template configs with placeholder 0.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/68b4bd69277eb634. Report an issue: GitHub.