tinyhumansai/openhuman · error

missing value for --port

Error message

missing value for --port

What it means

`openhuman run --port` expects a value in the next token and the flag was the last argument, so `args.get(i + 1)` returned None. Note this parser does not reject flag-looking values (unlike the launch-option parser), so `--port --host x` does NOT hit this — the '--host' token is consumed as the value and fails later as 'invalid --port'.

Source

Thrown at src/core/cli.rs:374

/// # Arguments
///
/// * `args` - Command-line arguments for the `run` command (e.g., `--port`).
fn run_server_command(args: &[String]) -> Result<()> {
    let mut port: Option<u16> = None;
    let mut host: Option<String> = None;
    let mut socketio_enabled = true;
    let mut headless_api = false;
    let mut verbose = false;
    let log_scope = CliLogDefault::Global;
    let mut i = 0usize;

    // Manual argument parsing loop for specific flags.
    while i < args.len() {
        match args[i].as_str() {
            "--port" => {
                let raw = args
                    .get(i + 1)
                    .ok_or_else(|| anyhow::anyhow!("missing value for --port"))?;
                port = Some(
                    raw.parse::<u16>()
                        .map_err(|e| anyhow::anyhow!("invalid --port: {e}"))?,
                );
                i += 2;
            }
            "--host" => {
                host = Some(
                    args.get(i + 1)
                        .ok_or_else(|| anyhow::anyhow!("missing value for --host"))?
                        .clone(),
                );
                i += 2;
            }
            "--jsonrpc-only" => {
                socketio_enabled = false;
                i += 1;
            }

View on GitHub (pinned to a221052e0d)

Solutions

  1. Pass the port: `openhuman run --port 7788`
  2. Or omit the flag and use the default (7788, or OPENHUMAN_CORE_PORT)

Example fix

# before
openhuman run --port
# after
openhuman run --port 7788
Defensive patterns

Strategy: validation

Validate before calling

# bash: only emit --port when a value is actually available
args=(run)
[ -n "${PORT:-}" ] && args+=(--port "$PORT")
exec openhuman "${args[@]}"

Prevention

When it happens

Trigger: `openhuman run --port` as the final token; a script appending --port conditionally without its value.

Common situations: Flag/value pairs split across script lines or variables with the value half missing; docs copy-paste that drops the value; assuming the port flag is a no-arg switch.

Related errors


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