influxdata/influxdb · error
prune percent must be between 0 and 1
Error message
prune percent must be between 0 and 1
What it means
Raised in the FromStr implementation of the prune-percent config type. After parsing the value as f64, it is rejected unless strictly between 0.0 and 1.0, since the prune percent is an inclusive-exclusive fraction (e.g. 0.2 for 20%).
Solutions
- Provide the value as a fraction strictly between 0 and 1, e.g. 0.2 instead of 20 or 0.
- Remove the prune-percent override to use the default if a custom value is not needed.
- Check the surrounding "failed to parse prune percent as f64" context if the value is non-numeric.
Example fix
# before --prune-percent 50 # after --prune-percent 0.5
Defensive patterns
Strategy: validation
Validate before calling
let p: f64 = value.parse()?;
if !(p > 0.0 && p < 1.0) {
return Err("prune percent must be strictly between 0 and 1 (e.g. 0.5)");
} Type guard
fn valid_prune_percent(p: f64) -> bool {
p > 0.0 && p < 1.0
} Prevention
- Always express percentages as fractions (0.5, not 50).
- Validate config values in scripts before passing them to the CLI.
- Remember the bounds are exclusive: 0 and 1 are both rejected.
When it happens
Trigger: Passing a value <= 0 or >= 1 for the prune percent option (e.g. `0`, `1`, `1.0`, `50` intending percent-as-integer).
Common situations: Users writing "50" meaning 50% instead of 0.5, or supplying 0/1 as boundary values that the type deliberately excludes.
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 parse object store config
- Could not find user's home directory
- environment variable
- invalid cache size
- invalid configuration provided
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/0f8a899f03bf9e3f.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3/src/commands/serve.rs:890
#[derive(Debug, Clone, Copy)]
pub struct ParquetCachePrunePercent(f64);
impl From<ParquetCachePrunePercent> for f64 {
fn from(value: ParquetCachePrunePercent) -> Self {
value.0
}
}
impl FromStr for ParquetCachePrunePercent {
type Err = anyhow::Error;
fn from_str(s: &str) -> std::prelude::v1::Result<Self, Self::Err> {
let p = s
.parse::<f64>()
.context("failed to parse prune percent as f64")?;
if p <= 0.0 || p >= 1.0 {
bail!("prune percent must be between 0 and 1");
}
Ok(Self(p))
}
}
/// Apply values given through deprecated legacy aliases of renamed size
/// options to their new counterparts, and warn about pre-3.11 value formats.
///
/// An explicitly set new name wins over its legacy alias, matching the
/// precedence `env_compat` applied when the old env var name was an alias of
/// the new one.
fn resolve_legacy_size_options(config: &mut Config, user_params: &HashMap<String, String>) {
fn apply(
legacy: Option<LegacyMemorySizeMb>,
legacy_flag: &str,
new_flag: &str,
new_value: &mut MemorySizeMb,
user_params: &HashMap<String, String>,View on GitHub (pinned to 06200ef96b)