tinyhumansai/openhuman · error

empty value for {arg}

Error message

empty value for {arg}

What it means

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.

Source

Thrown at src/core/cli.rs:171

        };

        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;
    }

    parsed.args = args[i..].to_vec();
    Ok(parsed)
}

#[cfg(feature = "tui")]
fn run_tui_from_cli(args: &[String]) -> Result<()> {
    crate::tui::run_from_cli(args)
}

View on GitHub (pinned to a221052e0d)

Solutions

  1. Provide a non-empty value: `--model gpt-4o` or `--model=gpt-4o`
  2. Guard expansions so empty variables drop the flag instead of passing it: `--model "${MODEL:-}"` only when non-empty
  3. Omit the flag to keep the configured default model/provider

Example fix

# before (MODEL unset in the environment)
openhuman chat --model "$MODEL"
# after
MODEL="${MODEL:-}"
if [ -n "$MODEL" ]; then openhuman chat --model "$MODEL"; else openhuman chat; fi
Defensive patterns

Strategy: validation

Validate before calling

# bash: drop all-whitespace overrides before invoking
trim() { printf '%s' "$1" | tr -d '[:space:]'; }
[ -n "$(trim "${MODEL:-}")" ] || unset MODEL
openhuman chat ${MODEL:+--model "$MODEL"}

Prevention

When it happens

Trigger: `--model=` with the inline form; `--model ""`; `--model "$MODEL"` where MODEL is unset or all-whitespace.

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

Related errors


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