{"record":{"id":"708cf9c6d030309a","repo":"Yeachan-Heo/oh-my-codex","slug":"unexpected-mission-argument-arg","errorCode":null,"errorMessage":"Unexpected mission argument: ${arg}","messagePattern":"Unexpected mission argument: (.+?)","errorType":"exception","errorClass":"MissionCommandError","httpStatus":null,"severity":"error","filePath":"src/cli/mission.ts","lineNumber":229,"sourceCode":"    if (arg.startsWith(\"--status=\")) {\n      const value = arg.slice(\"--status=\".length);\n      if (value !== \"blocked\" && value !== \"needs-human-review\") throw new MissionCommandError(`Unsupported mission mark status: ${value}`);\n      markStatus = value;\n      continue;\n    }\n    if (arg === \"--status\") {\n      const value = readValue(commandArgs, index, arg);\n      if (value !== \"blocked\" && value !== \"needs-human-review\") throw new MissionCommandError(`Unsupported mission mark status: ${value}`);\n      markStatus = value;\n      index += 1;\n      continue;\n    }\n    if (arg.startsWith(\"--\")) throw new MissionCommandError(`Unknown mission option: ${arg}`);\n    if (!file) {\n      file = arg;\n      continue;\n    }\n    throw new MissionCommandError(`Unexpected mission argument: ${arg}`);\n  }\n\n  if (!file) throw new MissionCommandError(`Missing mission input file.\\n\\n${MISSION_HELP}`);\n  if (action !== \"rerun\" && action !== \"mark\" && taskId) throw new MissionCommandError(`--task is only supported for mission mark/rerun.`);\n  if (action === \"rerun\" && !taskId) throw new MissionCommandError(`mission rerun requires --task <id>.`);\n  if (action !== \"mark\" && markStatus) throw new MissionCommandError(`--status is only supported for mission mark.`);\n  if (action === \"mark\" && (!taskId || !markStatus)) throw new MissionCommandError(`mission mark requires --task <id> --status <blocked|needs-human-review>.`);\n  return { action, file, dryRun, continueOnError, json, slug, summaryPath, taskId, markStatus, codexArgs };\n}\n\nfunction missionCounts(tasks: MissionTask[]): MissionSummary[\"counts\"] {\n  return {\n    total: tasks.length,\n    planned: tasks.filter((task) => task.status === \"planned\").length,\n    passed: tasks.filter((task) => task.status === \"passed\").length,\n    failed: tasks.filter((task) => task.status === \"failed\").length,\n    skipped: tasks.filter((task) => task.status === \"skipped\").length,\n    blocked: tasks.filter((task) => task.status === \"blocked\").length,","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/mission.ts#L211-L247","documentation":"Thrown when a positional (non-flag) argument appears after a file argument has already been consumed. mission accepts exactly one positional input file.","triggerScenarios":"`mission run a.md b.md` — the second positional argument b.md triggers it. Also any bare token after the file.","commonSituations":"Passing multiple mission files at once expecting batch execution; a stray unquoted filename containing a space splitting into two tokens.","solutions":["Run one mission file per invocation","Quote file paths containing spaces","Loop over files in a shell script if you need batch behavior"],"exampleFix":"# before\nmission run a.md b.md\n# after\nfor f in a.md b.md; do mission run \"$f\"; done","handlingStrategy":"validation","validationCode":"const positional = args.filter(a => !a.startsWith('--') && !isAction(a));\nif (positional.length > 1) failEarly('one file only');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote file paths with spaces","Invoke once per file in scripts"],"tags":["cli","argument-validation","positional-args"],"backgroundTag":"too-many-cli-arguments","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}