{"record":{"id":"8000d53bb9d331d4","repo":"databendlabs/databend","slug":"remove-percent-must-in-0-100","errorCode":null,"errorMessage":"remove_percent MUST in [0, 100)!","messagePattern":"remove_percent MUST in \\[0, 100\\)!","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/binaries/metaverifier/main.rs","lineNumber":109,"sourceCode":"            on: true,\n            level: \"WARN\".to_string(),\n            format: LogFormat::Text,\n        },\n        ..Default::default()\n    };\n\n    let guards = init_logging(\"databend-metaverifier\", &log_config, BTreeMap::new());\n    Box::new(guards).leak();\n\n    println!(\"config: {:?}\", config);\n    if config.grpc_api_address.is_empty() {\n        println!(\"grpc_api_address MUST not be empty!\");\n        bail!(\"grpc_api_address MUST not be empty!\");\n    }\n\n    if config.remove_percent > 100 {\n        println!(\"remove_percent MUST in [0, 100)!\");\n        bail!(\"remove_percent MUST in [0, 100)!\");\n    }\n\n    let start = Instant::now();\n    let mut client_num = 0;\n    let (tx, rx) = mpsc::channel::<()>();\n    let mut handles = Vec::new();\n\n    // write a file as start\n    fs::write(VERIFIER_RESULT_FILE, \"START\")?;\n\n    while client_num < config.client {\n        client_num += 1;\n        let prefix = config.prefix;\n        let addrs: Vec<_> = config\n            .grpc_api_address\n            .split(',')\n            .map(|addr| addr.to_string())\n            .collect();","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/binaries/metaverifier/main.rs#L91-L127","documentation":"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).","triggerScenarios":"Running metaverifier with config `remove_percent = 100` or higher (or a negative-check shortcut being absent, so any value >100 passes the only guard).","commonSituations":"Misreading the option as a percentage that can be 100; typo like 1000 instead of 10; programmatic config generation producing out-of-range values.","solutions":["Set remove_percent to a value in the range 0..=99 in the metaverifier config.","If you intended to remove everything, use 99 (the tool intentionally excludes 100).","Add pre-flight validation in whatever generates the config so out-of-range values are rejected earlier."],"exampleFix":"// before (config.toml)\nremove_percent = 100\n// after (config.toml)\nremove_percent = 50","handlingStrategy":"validation","validationCode":"// validate remove_percent before launching metaverifier\nlet pct: u64 = config.remove_percent;\nif pct > 99 {\n    return Err(anyhow::anyhow!(\"remove_percent must be in [0, 100), got {}\", pct));\n}","typeGuard":"fn remove_percent_valid(p: u64) -> bool {\n    p <= 99\n}","tryCatchPattern":"match run_metaverifier(&config).await {\n    Err(e) if e.to_string().contains(\"remove_percent\") => {\n        eprintln!(\"set remove_percent to 0..=99 and rerun\");\n        std::process::exit(2);\n    }\n    other => other.expect(\"metaverifier failed\"),\n}","preventionTips":["Remember remove_percent is a half-open range: 100 is invalid.","Clamp generated configs to 0..=99 at write time.","Add a unit test for the config loader with boundary values 0, 99, 100."],"tags":["metaverifier","config","validation","range"],"backgroundTag":"value-out-of-range","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}