databendlabs/databend · error

remove_percent MUST in [0, 100)!

Error message

remove_percent MUST in [0, 100)!

What it means

metaverifier's `remove_percent` option controls what fraction of keys to remove during verification, and must be within [0, 100). The binary bails with this error when the configured value exceeds 100 (the message documents the half-open range: 100 itself is invalid).

Solutions

  1. Set remove_percent to a value in the range 0..=99 in the metaverifier config.
  2. If you intended to remove everything, use 99 (the tool intentionally excludes 100).
  3. Add pre-flight validation in whatever generates the config so out-of-range values are rejected earlier.

Example fix

// before (config.toml)
remove_percent = 100
// after (config.toml)
remove_percent = 50
Defensive patterns

Strategy: validation

Validate before calling

// validate remove_percent before launching metaverifier
let pct: u64 = config.remove_percent;
if pct > 99 {
    return Err(anyhow::anyhow!("remove_percent must be in [0, 100), got {}", pct));
}

Type guard

fn remove_percent_valid(p: u64) -> bool {
    p <= 99
}

Try / catch

match run_metaverifier(&config).await {
    Err(e) if e.to_string().contains("remove_percent") => {
        eprintln!("set remove_percent to 0..=99 and rerun");
        std::process::exit(2);
    }
    other => other.expect("metaverifier failed"),
}

Prevention

When it happens

Trigger: Running metaverifier with config `remove_percent = 100` or higher (or a negative-check shortcut being absent, so any value >100 passes the only guard).

Common situations: Misreading the option as a percentage that can be 100; typo like 1000 instead of 10; programmatic config generation producing out-of-range values.

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


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/8000d53bb9d331d4. Report an issue: GitHub.

Appendix: source

Thrown at src/meta/binaries/metaverifier/main.rs:109

            on: true,
            level: "WARN".to_string(),
            format: LogFormat::Text,
        },
        ..Default::default()
    };

    let guards = init_logging("databend-metaverifier", &log_config, BTreeMap::new());
    Box::new(guards).leak();

    println!("config: {:?}", config);
    if config.grpc_api_address.is_empty() {
        println!("grpc_api_address MUST not be empty!");
        bail!("grpc_api_address MUST not be empty!");
    }

    if config.remove_percent > 100 {
        println!("remove_percent MUST in [0, 100)!");
        bail!("remove_percent MUST in [0, 100)!");
    }

    let start = Instant::now();
    let mut client_num = 0;
    let (tx, rx) = mpsc::channel::<()>();
    let mut handles = Vec::new();

    // write a file as start
    fs::write(VERIFIER_RESULT_FILE, "START")?;

    while client_num < config.client {
        client_num += 1;
        let prefix = config.prefix;
        let addrs: Vec<_> = config
            .grpc_api_address
            .split(',')
            .map(|addr| addr.to_string())
            .collect();

View on GitHub (pinned to 288d84d76e)