{"record":{"id":"84434a2cacf2c04f","repo":"astrid-runtime/astrid","slug":"target-kib-requires-an-integer","errorCode":null,"errorMessage":"--target-kib requires an integer","messagePattern":"--target-kib requires an integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-chunker-evidence/src/main.rs","lineNumber":168,"sourceCode":"    let mut sketch_only = false;\n    let mut targets_kib = Vec::new();\n    let mut output = None;\n    let mut args = env::args().skip(1);\n    while let Some(argument) = args.next() {\n        match argument.as_str() {\n            \"--corpus\" => corpus_specs.push(parse_path_specification(\"--corpus\", args.next())?),\n            \"--version-chain\" => {\n                version_chain_specs.push(parse_path_specification(\"--version-chain\", args.next())?);\n            },\n            \"--git-history\" => {\n                git_history_specs.push(parse_git_specification(args.next())?);\n            },\n            \"--no-synthetic\" => include_synthetic = false,\n            \"--sketch-only\" => sketch_only = true,\n            \"--target-kib\" => {\n                let target = args\n                    .next()\n                    .ok_or_else(|| anyhow::anyhow!(\"--target-kib requires an integer\"))?\n                    .parse::<u32>()\n                    .context(\"parse --target-kib\")?;\n                targets_kib.push(target);\n            },\n            \"--output\" => {\n                let path = args\n                    .next()\n                    .ok_or_else(|| anyhow::anyhow!(\"--output requires a path\"))?;\n                output = Some(PathBuf::from(path));\n            },\n            \"-h\" | \"--help\" => {\n                print_help();\n                std::process::exit(0);\n            },\n            unknown => bail!(\"unknown argument {unknown:?}; use --help\"),\n        }\n    }\n    if targets_kib.is_empty() {","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-chunker-evidence/src/main.rs#L150-L186","documentation":"CLI argument parse error in `parse_options`: `--target-kib` was given but the next argument is missing. The flag requires a following unsigned 32-bit integer (the KiB target for the chunker profile comparison); the parser refuses to continue without it.","triggerScenarios":"Running the chunker evidence binary as `... --target-kib` with nothing after it — e.g. `--target-kib` last on the command line, or immediately followed by another flag like `--sketch-only` (which then also triggers 'unknown argument').","commonSituations":"Shell line-continuation dropping the value; copy-pasting the flag without the number; script variable holding the value expanding to empty.","solutions":["Pass an integer after the flag: `--target-kib 64` (repeatable for multiple targets).","Check shell quoting/expansion so the value isn't dropped (e.g. quote \"${TARGET}\" and verify it is non-empty).","Run with `--help` to see the expected `--target-kib N` syntax."],"exampleFix":"// before\nmybin --target-kib\n// after\nmybin --target-kib 64 --target-kib 128","handlingStrategy":"validation","validationCode":"fn has_value_after(args: &[String], flag: &str) -> bool {\n    args.iter().position(|a| a == flag)\n        .map(|i| args.get(i + 1).map_or(false, |v| v.parse::<u32>().is_ok()))\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"let target: Option<u32> = std::env::args().nth(1).and_then(|v| v.parse().ok());\nassert!(target.is_some(), \"--target-kib requires an integer value\");","preventionTips":["Quote interpolated shell variables and verify they are non-empty.","Always place the numeric value immediately after the flag.","Add a smoke test invoking the binary with representative flags."],"tags":["cli","rust","argument-parsing"],"backgroundTag":"missing-cli-argument","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}