{"record":{"id":"c26fb51273b5c400","repo":"tinyhumansai/openhuman","slug":"missing-value-for-arg-c26fb5","errorCode":null,"errorMessage":"missing value for {arg}","messagePattern":"missing value for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/core/cli.rs","lineNumber":162,"sourceCode":"                (Some(\"model\"), arg.split_once('=').map(|v| v.1))\n            }\n            _ if arg.starts_with(\"--provider=\") => {\n                (Some(\"provider\"), arg.split_once('=').map(|v| v.1))\n            }\n            _ if arg.starts_with(\"--provider-id=\") => {\n                (Some(\"provider\"), arg.split_once('=').map(|v| v.1))\n            }\n            _ => break,\n        };\n\n        let value = match inline_value {\n            Some(value) => value,\n            None => {\n                i += 1;\n                let value = args\n                    .get(i)\n                    .map(String::as_str)\n                    .ok_or_else(|| anyhow::anyhow!(\"missing value for {arg}\"))?;\n                if value.starts_with('-') {\n                    return Err(anyhow::anyhow!(\"missing value for {arg}\"));\n                }\n                value\n            }\n        };\n        let value = value.trim();\n        if value.is_empty() {\n            return Err(anyhow::anyhow!(\"empty value for {arg}\"));\n        }\n        match target {\n            Some(\"model\") => parsed.model = Some(value.to_string()),\n            Some(\"provider\") => parsed.provider = Some(value.to_string()),\n            _ => unreachable!(\"launch option target is fixed above\"),\n        }\n        i += 1;\n    }\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/core/cli.rs#L144-L180","documentation":"Thrown by parse_launch_options (src/core/cli.rs) for the global `--model/--model-id/-m` and `--provider/--provider-id/-p` launch flags when no value token follows — either the flag is the last argument (args.get(i) is None) or the next token starts with '-' and is presumed to be another flag. Inline forms like --model=x bypass this because the value is embedded.","triggerScenarios":"`openhuman --model` as the last token; `openhuman -m --no-tui` where the next token is a flag; or `openhuman -p -m foo` where -p tries to consume '-m'. The parser runs before the subcommand, so these are launch-wide flags, not per-subcommand ones.","commonSituations":"Shell wrappers interpolating an empty MODEL/PROVIDER variable after the flag; forgetting the value; or reordering flags so a value-consumer collides with the next flag. Note the value check rejects anything starting with '-', so negative-looking values are impossible here by design.","solutions":["Provide the value: `--model <id>` / `--provider <id>`, or use the inline form `--model=<id>`.","Fix ordering: put the value immediately after its flag (`openhuman --model x --no-tui chat`).","In scripts, default or check the variable before composing the command (`MODEL=\"${MODEL:-}\"; [ -n \"$MODEL\" ] || unset MODEL_FLAG`)."],"exampleFix":"# before\nopenhuman --model --no-tui\n\n# after\nopenhuman --model claude-sonnet-4 --no-tui\n# or inline form\nopenhuman --model=claude-sonnet-4 --no-tui","handlingStrategy":"validation","validationCode":"# shell: only emit the launch flag when a value exists, or use inline form\n[ -n \"${MODEL:-}\" ] && set -- --model=\"$MODEL\" \"$@\"\nexec openhuman \"$@\"\n\n# or in Rust before calling the CLI entry:\nfn launch_flag_has_value(args: &[String]) -> bool {\n    let mut i = 0;\n    while i < args.len() {\n        let a = &args[i];\n        if matches!(a.as_str(), \"--model\" | \"--model-id\" | \"-m\" | \"--provider\" | \"--provider-id\" | \"-p\") {\n            match args.get(i + 1) {\n                Some(v) if !v.starts_with('-') => i += 2,\n                _ => return false,\n            }\n        } else { i += 1; }\n    }\n    true\n}","typeGuard":null,"tryCatchPattern":"match parse_launch_options(&args) {\n    Err(e) if e.to_string().contains(\"missing value for\") => {\n        eprintln!(\"global flags need a value: --model <id> / --provider <id> (or --model=<id>), placed before the subcommand\");\n    }\n    other => other?,\n}","preventionTips":["Prefer inline forms (--model=x, --provider=y) in scripts: they cannot dangle or swallow the next flag.","Keep global launch flags before the subcommand with their values immediately after.","Remember values starting with '-' are rejected by design — a collision means your flags are misordered."],"tags":["rust","cli","argument-parsing","missing-value","launch-options"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}