tinyhumansai/openhuman · error · Error

unknown option: ${arg}

Error message

unknown option: ${arg}

What it means

parseArgs() in scripts/debug/agent-prepare-context-audit.mjs is a strict switch over known flags; any token not matching a case (and not consumed as a value by next()) falls into default and throws 'unknown option: <arg>'. The accepted set is exactly the one in usage(): --core-url, --token, --workspace, --model, --query, --raw, --scout-prompt-file, --thread-prefix, --no-seed-transcript, --max-print-chars, --rpc-timeout-ms, --spawn-core, --keep-workspace, --json, --verbose, -h/--help.

Source

Thrown at scripts/debug/agent-prepare-context-audit.mjs:178

        break;
      case "--spawn-core":
        opts.spawnCore = true;
        break;
      case "--keep-workspace":
        opts.keepWorkspace = true;
        break;
      case "--json":
        opts.json = true;
        break;
      case "--verbose":
        opts.verbose = true;
        break;
      case "-h":
      case "--help":
        console.log(usage());
        process.exit(0);
      default:
        throw new Error(`unknown option: ${arg}`);
    }
  }
  return opts;
}

function parsePositiveInt(raw, label) {
  const value = Number(raw);
  if (!Number.isInteger(value) || value < 1)
    throw new Error(`${label} must be a positive integer`);
  return value;
}

function defaultOpenhumanDir() {
  if (process.env.OPENHUMAN_APP_ENV === "staging") {
    return path.join(homedir(), ".openhuman-staging");
  }
  if (process.env.OPENHUMAN_APP_ENV) {
    return path.join(homedir(), ".openhuman");

View on GitHub (pinned to a221052e0d)

Solutions

  1. Run with -h/--help and diff your command against the printed option list
  2. Fix the typo — most commonly an underscore where a dash belongs (--spawn-core, --keep-workspace)
  3. Move options that belong to a different script back to that script; this audit tool has no --case/--reset equivalents

Example fix

# before
$ node scripts/debug/agent-prepare-context-audit.mjs --spawn_core
Error: unknown option: --spawn_core

# after
$ node scripts/debug/agent-prepare-context-audit.mjs --spawn-core
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(["--core-url","--token","--workspace","--model","--query","--raw","--scout-prompt-file","--thread-prefix","--no-seed-transcript","--max-print-chars","--rpc-timeout-ms","--spawn-core","--keep-workspace","--json","--verbose","-h","--help"]);
const unknown = argv.filter((a) => a.startsWith("-") && !KNOWN.has(a));
if (unknown.length) { console.error(`unknown options: ${unknown.join(", ")}`); process.exit(2); }

Prevention

When it happens

Trigger: A typo'd or unsupported flag anywhere in argv, e.g. --jsn, --tokn, --spawn_core (underscore instead of dash), or a flag from a different debug script (like goals-live.mjs's --isolated-workspace or --case) passed to this one. Boolean flags that don't exist here are the most common hit.

Common situations: Copy-pasting option lines between the sibling debug runners (harness-cache-audit.mjs, goals-live.mjs) whose flag sets differ; muscle-memory underscores; abbreviating flags that the parser does not support.

Related errors


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