{"record":{"id":"1e99bee19680b8f2","repo":"tinyhumansai/openhuman","slug":"empty-value-for-arg","errorCode":null,"errorMessage":"empty value for {arg}","messagePattern":"empty value for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/cli.rs","lineNumber":171,"sourceCode":"        };\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\n    parsed.args = args[i..].to_vec();\n    Ok(parsed)\n}\n\n#[cfg(feature = \"tui\")]\nfn run_tui_from_cli(args: &[String]) -> Result<()> {\n    crate::tui::run_from_cli(args)\n}\n","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/core/cli.rs#L153-L189","documentation":"A value token WAS found for --model/--provider, but after trimming it is empty — e.g. `--model=` (inline equals form with nothing after it) or `--model \"   \"`. The parser trims and rejects whitespace-only values so downstream override logic never receives a value that looks set but carries no information, which would silently mask the config default.","triggerScenarios":"`--model=` with the inline form; `--model \"\"`; `--model \"$MODEL\"` where MODEL is unset or all-whitespace.","commonSituations":"Environment-variable expansion of an unset/empty variable into a flag value; CI pipelines passing through empty secrets or placeholders; whitespace introduced by copy-paste.","solutions":["Provide a non-empty value: `--model gpt-4o` or `--model=gpt-4o`","Guard expansions so empty variables drop the flag instead of passing it: `--model \"${MODEL:-}\"` only when non-empty","Omit the flag to keep the configured default model/provider"],"exampleFix":"# before (MODEL unset in the environment)\nopenhuman chat --model \"$MODEL\"\n# after\nMODEL=\"${MODEL:-}\"\nif [ -n \"$MODEL\" ]; then openhuman chat --model \"$MODEL\"; else openhuman chat; fi","handlingStrategy":"validation","validationCode":"# bash: drop all-whitespace overrides before invoking\ntrim() { printf '%s' \"$1\" | tr -d '[:space:]'; }\n[ -n \"$(trim \"${MODEL:-}\")\" ] || unset MODEL\nopenhuman chat ${MODEL:+--model \"$MODEL\"}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote and default env expansions: --model \"${MODEL:-}\" only after checking it is non-empty","Treat an empty override as 'not set' in wrapper scripts instead of forwarding it","Remember the parser trims whitespace — a quoted blank string is still empty"],"tags":["cli","argument-parsing","launch-options","environment"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}