{"record":{"id":"490296b061a10084","repo":"astrid-runtime/astrid","slug":"flag-requires-name-path","errorCode":null,"errorMessage":"{flag} requires NAME=PATH","messagePattern":"(.+?) requires NAME=PATH","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-chunker-evidence/src/main.rs","lineNumber":223,"sourceCode":"    let (repository, relative_path) = combined\n        .split_once(\"::\")\n        .ok_or_else(|| anyhow::anyhow!(\"--git-history requires NAME=REPO::RELATIVE_PATH\"))?;\n    if repository.is_empty() || relative_path.is_empty() {\n        bail!(\"--git-history requires non-empty NAME=REPO::RELATIVE_PATH\");\n    }\n    Ok((\n        name,\n        PathBuf::from(repository),\n        PathBuf::from(relative_path),\n    ))\n}\n\nfn parse_path_specification(\n    flag: &str,\n    specification: Option<String>,\n) -> Result<(String, PathBuf)> {\n    let specification =\n        specification.ok_or_else(|| anyhow::anyhow!(\"{flag} requires NAME=PATH\"))?;\n    let (name, path) = specification\n        .split_once('=')\n        .ok_or_else(|| anyhow::anyhow!(\"{flag} requires NAME=PATH\"))?;\n    if name.is_empty() || path.is_empty() {\n        bail!(\"{flag} requires non-empty NAME=PATH\");\n    }\n    Ok((name.to_owned(), PathBuf::from(path)))\n}\n\nfn print_help() {\n    println!(\n        \"Usage: astrid-storage-chunker-evidence [OPTIONS]\\n\\\n         \\n\\\n         Options:\\n\\\n         \\x20 --corpus NAME=PATH       Add a directory snapshot; paths stay out of reports\\n\\\n         \\x20 --version-chain NAME=PATH\\n\\\n         \\x20                          Add lexically ordered version files\\n\\\n         \\x20 --git-history NAME=REPO::RELATIVE_PATH\\n\\","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-chunker-evidence/src/main.rs#L205-L241","documentation":"This error comes from parse_path_specification in the chunker-evidence CLI. A NAME=PATH specification (e.g. --volume primary=/path/to/dir) was required, but the flag was given with no value at all. The library refuses to proceed because it cannot construct an evidence mapping without both a name and a path.","triggerScenarios":"Calling parse_path_specification (via parse_options or parse_git_specification) with specification == None, i.e. the CLI flag was passed without any argument value after it.","commonSituations":"Running the binary with a flag like --volume but forgetting the value; shell scripts that build argument arrays and drop an empty variable; typos where the value was attached to a different flag.","solutions":["Pass a value in NAME=PATH form after the flag, e.g. --volume primary=/data/evidence.","Check the argument parsing wiring so the flag's value is captured as Some(String) rather than dropped.","Add shell quoting so an empty variable does not silently remove the argument."],"exampleFix":"// before\nmybin --volume\n// after\nmybin --volume primary=/data/evidence","handlingStrategy":"validation","validationCode":"fn validate_path_spec(spec: &Option<String>) -> Result<(), String> {\n    match spec {\n        None => Err(\"flag requires NAME=PATH\".into()),\n        Some(s) if !s.contains('=') => Err(\"flag requires NAME=PATH\".into()),\n        Some(s) => {\n            let (n, p) = s.split_once('=').unwrap();\n            if n.is_empty() || p.is_empty() { Err(\"empty NAME or PATH\".into()) } else { Ok(()) }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"match parse_path_specification(flag, spec) {\n    Ok((name, path)) => use_spec(name, path),\n    Err(e) => eprintln!(\"usage: {flag} NAME=PATH ({e:#})\"),\n}","preventionTips":["Always quote flag values in shell scripts so empty variables do not drop the argument.","Add a shell-level check that the value contains '=' before invoking the binary.","Document the NAME=PATH syntax next to the flag in help text."],"tags":["cli","argument-parsing","rust"],"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"}