{"record":{"id":"68b4bd69277eb634","repo":"risingwavelabs/risingwave","slug":"invalid-value-for-bounded-strategy-must-be-positi","errorCode":null,"errorMessage":"Invalid value for Bounded strategy: must be positive integer","messagePattern":"Invalid value for Bounded strategy: must be positive integer","errorType":"validation","errorClass":"ParallelismStrategyParseError","httpStatus":null,"severity":"error","filePath":"src/common/src/system_param/adaptive_parallelism_strategy.rs","lineNumber":73,"sourceCode":"\nimpl From<AdaptiveParallelismStrategy> for String {\n    fn from(val: AdaptiveParallelismStrategy) -> Self {\n        val.to_string()\n    }\n}\n\n#[derive(Error, Debug)]\npub enum ParallelismStrategyParseError {\n    #[error(\"Unsupported strategy: {0}\")]\n    UnsupportedStrategy(String),\n\n    #[error(\"Parse error: {0}\")]\n    ParseIntError(#[from] std::num::ParseIntError),\n\n    #[error(\"Parse error: {0}\")]\n    ParseFloatError(#[from] std::num::ParseFloatError),\n\n    #[error(\"Invalid value for Bounded strategy: must be positive integer\")]\n    InvalidBoundedValue,\n\n    #[error(\"Invalid value for Ratio strategy: must be between 0.0 and 1.0\")]\n    InvalidRatioValue,\n}\n\nimpl AdaptiveParallelismStrategy {\n    pub fn compute_target_parallelism(&self, current_parallelism: usize) -> usize {\n        match self {\n            AdaptiveParallelismStrategy::Auto | AdaptiveParallelismStrategy::Full => {\n                current_parallelism\n            }\n            AdaptiveParallelismStrategy::Bounded(n) => min(n.get(), current_parallelism),\n            AdaptiveParallelismStrategy::Ratio(r) => {\n                max((current_parallelism as f32 * r).floor() as usize, 1)\n            }\n        }\n    }","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/common/src/system_param/adaptive_parallelism_strategy.rs#L55-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"Computing bounds from variables that can evaluate to 0; misunderstanding 'bounded' as an inclusive lower bound; copy-paste of template configs with placeholder 0.","solutions":["Use a strictly positive integer: 'bounded(1)' or higher.","If you want automatic sizing rather than a fixed bound, use 'auto' or 'default' instead.","Validate that any programmatically computed bound is > 0 before setting the parameter."],"exampleFix":"// before\nSET adaptive_parallelism_strategy = 'bounded(0)';\n// after\nSET adaptive_parallelism_strategy = 'bounded(1)';","handlingStrategy":"validation","validationCode":"// Pre-validate bound positivity\nfn set_bounded(n: u64) -> Result<String, String> {\n    let n = std::num::NonZeroU64::new(n).ok_or(\"bounded requires n > 0\")?;\n    Ok(format!(\"bounded({})\", n.get()))\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(ParallelismStrategyParseError::InvalidBoundedValue) => {\n        eprintln!(\"bounded strategy requires a positive integer (>= 1)\");\n    }\n    other => other?,\n}","preventionTips":["Check any computed bound is > 0 before setting (guard divisions/fallbacks that can yield 0).","Use NonZeroU64 at the call site to make positivity a type-level invariant.","Prefer 'auto' when no explicit positive bound is known."],"tags":["config","parallelism","validation","risingwave"],"backgroundTag":"argument-out-of-range","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}