tinyhumansai/openhuman · warning

missing value for {arg}

Error message

missing value for {arg}

What it means

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.

Source

Thrown at src/core/cli.rs:162

                (Some("model"), arg.split_once('=').map(|v| v.1))
            }
            _ if arg.starts_with("--provider=") => {
                (Some("provider"), arg.split_once('=').map(|v| v.1))
            }
            _ if arg.starts_with("--provider-id=") => {
                (Some("provider"), arg.split_once('=').map(|v| v.1))
            }
            _ => break,
        };

        let value = match inline_value {
            Some(value) => value,
            None => {
                i += 1;
                let value = args
                    .get(i)
                    .map(String::as_str)
                    .ok_or_else(|| anyhow::anyhow!("missing value for {arg}"))?;
                if value.starts_with('-') {
                    return Err(anyhow::anyhow!("missing value for {arg}"));
                }
                value
            }
        };
        let value = value.trim();
        if value.is_empty() {
            return Err(anyhow::anyhow!("empty value for {arg}"));
        }
        match target {
            Some("model") => parsed.model = Some(value.to_string()),
            Some("provider") => parsed.provider = Some(value.to_string()),
            _ => unreachable!("launch option target is fixed above"),
        }
        i += 1;
    }

View on GitHub (pinned to a221052e0d)

Solutions

  1. Provide the value: `--model <id>` / `--provider <id>`, or use the inline form `--model=<id>`.
  2. Fix ordering: put the value immediately after its flag (`openhuman --model x --no-tui chat`).
  3. In scripts, default or check the variable before composing the command (`MODEL="${MODEL:-}"; [ -n "$MODEL" ] || unset MODEL_FLAG`).

Example fix

# before
openhuman --model --no-tui

# after
openhuman --model claude-sonnet-4 --no-tui
# or inline form
openhuman --model=claude-sonnet-4 --no-tui
Defensive patterns

Strategy: validation

Validate before calling

# shell: only emit the launch flag when a value exists, or use inline form
[ -n "${MODEL:-}" ] && set -- --model="$MODEL" "$@"
exec openhuman "$@"

# or in Rust before calling the CLI entry:
fn launch_flag_has_value(args: &[String]) -> bool {
    let mut i = 0;
    while i < args.len() {
        let a = &args[i];
        if matches!(a.as_str(), "--model" | "--model-id" | "-m" | "--provider" | "--provider-id" | "-p") {
            match args.get(i + 1) {
                Some(v) if !v.starts_with('-') => i += 2,
                _ => return false,
            }
        } else { i += 1; }
    }
    true
}

Try / catch

match parse_launch_options(&args) {
    Err(e) if e.to_string().contains("missing value for") => {
        eprintln!("global flags need a value: --model <id> / --provider <id> (or --model=<id>), placed before the subcommand");
    }
    other => other?,
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/c26fb51273b5c400. Report an issue: GitHub.