{"record":{"id":"43467051870db5bc","repo":"tinyhumansai/openhuman","slug":"missing-value-for-flag","errorCode":null,"errorMessage":"missing value for {flag}","messagePattern":"missing value for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/memory_cli.rs","lineNumber":450,"sourceCode":"        eprintln!(\"[memory:cli] namespace '{namespace}' cleared\");\n        Ok::<_, anyhow::Error>(())\n    })?;\n\n    Ok(())\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfn is_help(s: &str) -> bool {\n    matches!(s, \"-h\" | \"--help\" | \"help\")\n}\n\nfn next_arg(args: &[String], i: &mut usize, flag: &str) -> Result<String> {\n    let value = args\n        .get(*i + 1)\n        .ok_or_else(|| anyhow::anyhow!(\"missing value for {flag}\"))?\n        .clone();\n    *i += 2;\n    Ok(value)\n}\n\nfn read_input(path: &str) -> Result<String> {\n    if path == \"-\" {\n        let mut buf = String::new();\n        std::io::stdin().read_to_string(&mut buf)?;\n        Ok(buf)\n    } else {\n        let path = PathBuf::from(path);\n        if !path.exists() {\n            return Err(anyhow::anyhow!(\"file not found: {}\", path.display()));\n        }\n        Ok(std::fs::read_to_string(&path)?)\n    }\n}","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/core/memory_cli.rs#L432-L468","documentation":"Generic guard in the shared `next_arg` helper used by the memory CLI parsers. When a flag that requires a value (--namespace, --query, --limit) is the last token on the command line, args.get(i+1) is None and this fires with the offending flag name substituted in. It reports a truncated command line, not a bad value.","triggerScenarios":"Thrown at src/core/memory_cli.rs:450 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Put the value immediately after the flag: `--namespace myns`, not `--namespace` at end of line.","Check shell quoting so the value is not consumed or split unexpectedly.","Re-run with -h to confirm which flags take values."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}