tinyhumansai/openhuman · error

missing value for

Error message

missing value for {flag}

What it means

Generic guard in the shared `next_arg` helper used by the memory CLI parsers. When a flag that requires a value (--namespace, --query, --limit) is the last token on the command line, args.get(i+1) is None and this fires with the offending flag name substituted in. It reports a truncated command line, not a bad value.

Solutions

  1. Put the value immediately after the flag: `--namespace myns`, not `--namespace` at end of line.
  2. Check shell quoting so the value is not consumed or split unexpectedly.
  3. Re-run with -h to confirm which flags take values.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/memory_cli.rs:450 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/43467051870db5bc. Report an issue: GitHub.

Appendix: source

Thrown at src/core/memory_cli.rs:450

        eprintln!("[memory:cli] namespace '{namespace}' cleared");
        Ok::<_, anyhow::Error>(())
    })?;

    Ok(())
}

// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------

fn is_help(s: &str) -> bool {
    matches!(s, "-h" | "--help" | "help")
}

fn next_arg(args: &[String], i: &mut usize, flag: &str) -> Result<String> {
    let value = args
        .get(*i + 1)
        .ok_or_else(|| anyhow::anyhow!("missing value for {flag}"))?
        .clone();
    *i += 2;
    Ok(value)
}

fn read_input(path: &str) -> Result<String> {
    if path == "-" {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf)?;
        Ok(buf)
    } else {
        let path = PathBuf::from(path);
        if !path.exists() {
            return Err(anyhow::anyhow!("file not found: {}", path.display()));
        }
        Ok(std::fs::read_to_string(&path)?)
    }
}

View on GitHub (pinned to 7491200858)