tinyhumansai/openhuman · error · Error

missing value for ${arg}

Error message

missing value for ${arg}

What it means

parseArgs() in scripts/debug/goals-live.mjs (live test harness for the memory_goals domain) uses the same next() pattern as its sibling scripts: value-taking options (--core-url, --token, --workspace, --case, --context, --model, --rpc-timeout-ms) consume the following argv token, and when none exists the helper throws 'missing value for <flag>'.

Source

Thrown at scripts/debug/goals-live.mjs:78

    token: process.env.OPENHUMAN_CORE_TOKEN || "",
    workspace: process.env.OPENHUMAN_WORKSPACE || "",
    spawnCore: false,
    isolatedWorkspace: false,
    keepWorkspace: false,
    cases: [],
    reset: false,
    context: "",
    model: "",
    showThoughts: false,
    rpcTimeoutMs: 600_000,
    verbose: false,
    coreUrlExplicit: Boolean(process.env.OPENHUMAN_CORE_RPC_URL),
  };
  for (let i = 0; i < argv.length; i += 1) {
    const arg = argv[i];
    const next = () => {
      const value = argv[++i];
      if (value === undefined) throw new Error(`missing value for ${arg}`);
      return value;
    };
    switch (arg) {
      case "--core-url":
        opts.coreUrl = next();
        opts.coreUrlExplicit = true;
        break;
      case "--token":
        opts.token = next();
        break;
      case "--workspace":
        opts.workspace = next();
        break;
      case "--spawn-core":
        opts.spawnCore = true;
        break;
      case "--isolated-workspace":
        opts.isolatedWorkspace = true;

View on GitHub (pinned to a221052e0d)

Solutions

  1. Append the value immediately after the flag: --model <model-id>
  2. Drop flags you don't need rather than leaving them valueless
  3. Prefer environment forms for optional values (OPENHUMAN_CORE_TOKEN, OPENHUMAN_WORKSPACE) which never dangle

Example fix

# before
$ node scripts/debug/goals-live.mjs --case
Error: missing value for --case

# after
$ node scripts/debug/goals-live.mjs --case reflect --context "shipping focus"
Defensive patterns

Strategy: validation

Validate before calling

const VALUE_FLAGS = new Set(["--core-url", "--token", "--workspace", "--case", "--context", "--model", "--rpc-timeout-ms"]);
for (let i = 0; i < argv.length; i++) {
  if (VALUE_FLAGS.has(argv[i]) && (i + 1 >= argv.length || argv[i + 1].startsWith("--"))) {
    console.error(`${argv[i]} requires a value`); process.exit(2);
  }
}

Prevention

When it happens

Trigger: Invoking goals-live.mjs with a value-taking flag as the final token, e.g. `node scripts/debug/goals-live.mjs --context` or `pnpm debug goals-live --model`. The check fires before any validation of the value itself, so `--case` with no argument fails here rather than with the 'unknown case' error.

Common situations: Building the command incrementally and stopping after the flag; shell wrappers dropping an unquoted empty argument; copying a partial command from the usage examples at the top of the file where the value was on the next line.

Related errors


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