{"record":{"id":"79df2c8f7e0d8c97","repo":"can1357/oh-my-pi","slug":"unknown-flag-arg-see-help","errorCode":null,"errorMessage":"unknown flag: ${arg} (see --help)","messagePattern":"unknown flag: (.+?) \\(see --help\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/runner.ts","lineNumber":362,"sourceCode":"\t\t\t\tconst eq2 = spec.indexOf(\"=\");\n\t\t\t\tif (eq2 === -1) {\n\t\t\t\t\tconst hostVal = process.env[spec];\n\t\t\t\t\tif (hostVal !== undefined) cfg.env[spec] = hostVal;\n\t\t\t\t} else {\n\t\t\t\t\tcfg.env[spec.slice(0, eq2)] = spec.slice(eq2 + 1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"--environment\": {\n\t\t\t\tconst v = take(arg);\n\t\t\t\tif (v !== \"docker\" && v !== \"apple-container\") {\n\t\t\t\t\tthrow new Error(\"--environment must be docker|apple-container\");\n\t\t\t\t}\n\t\t\t\tcfg.envType = v;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`unknown flag: ${arg} (see --help)`);\n\t\t}\n\t}\n\tif (cfg.models.length === 0) cfg.models = [\"anthropic/claude-sonnet-4-6\"];\n\tif (cfg.envType === \"apple-container\") {\n\t\tif (cfg.hostNetwork) throw new Error(\"--host-network is docker-only (compose overlay)\");\n\t\t// host.docker.internal doesn't exist on vmnet; containers reach the host at the bridge address.\n\t\tif (cfg.gatewayUrl === DOCKER_GATEWAY_URL) cfg.gatewayUrl = VMNET_GATEWAY_URL;\n\t}\n\treturn cfg;\n}\n\n// ─────────────────────────────────────────────────────────────────── resume\n\n/** manager.json launch record written by RunStore.registerLaunch. */\ninterface ManagerRecord {\n\tbenchmark?: string;\n\tdataset?: string;\n\tconfig?: LaunchRequest;","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/runner.ts#L344-L380","documentation":"parseArgs has a fixed set of recognized flags; the default branch throws for anything unrecognized, appending '(see --help)' to point at the documentation. This is the standard argparse-style fail-fast for mistyped or unsupported flags.","triggerScenarios":"Typos like `--jobname` instead of the real flag, `--env` as a shorthand that does not exist, passing a positional-looking stray token starting with '-', or using a flag from a different tool/version.","commonSituations":"Copying flags from an older/newer version of the runner; muscle-memory shorthand flags; pasting commands from blog posts about other harnesses; a shell variable expanding to an empty string leaving a dangling '-' prefix.","solutions":["Run the runner with --help to list valid flags.","Fix the typo / use the full flag name — no shorthand forms exist.","Check the version you are running matches the docs (`runner --version`); flags may have been renamed.","Quote or guard interpolated variables in scripts so they don't expand into stray tokens: \"${FLAG:-}\"."],"exampleFix":"// before\nrunner --env docker\n// after\nrunner --environment docker","handlingStrategy":"validation","validationCode":"const KNOWN_FLAGS = new Set([\"--agent\",\"--install\",\"--binary\",\"--no-build\",\"--environment\",\"--host-network\",\"--version\",\"--resume\",\"--jobs-dir\",\"--help\"]);\nconst unknown = argv.filter(a => a.startsWith(\"--\") && !KNOWN_FLAGS.has(a));\nif (unknown.length) throw new Error(`unknown flags before invoking runner: ${unknown.join(\",\")}`);","typeGuard":"function isKnownFlag(a: string): boolean {\n  return a.startsWith(\"--\") ? KNOWN_FLAGS.has(a) : true;\n}","tryCatchPattern":"try {\n  await runHarness(args);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"unknown flag:\")) {\n    console.error(e.message + \" — run the runner with --help for the valid flag list.\");\n  } else throw e;\n}","preventionTips":["Always check --help after upgrading the runner — flags get renamed.","Quote/guard shell variables to avoid empty-string expansions becoming stray tokens.","Avoid shorthand flags; they do not exist."],"tags":["cli","argument-validation","unknown-flag"],"backgroundTag":"unknown-cli-flag","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}