Yeachan-Heo/oh-my-codex · error · MissionCommandError

Unexpected mission argument: ${arg}

Error message

Unexpected mission argument: ${arg}

What it means

Thrown when a positional (non-flag) argument appears after a file argument has already been consumed. mission accepts exactly one positional input file.

Source

Thrown at src/cli/mission.ts:229

    if (arg.startsWith("--status=")) {
      const value = arg.slice("--status=".length);
      if (value !== "blocked" && value !== "needs-human-review") throw new MissionCommandError(`Unsupported mission mark status: ${value}`);
      markStatus = value;
      continue;
    }
    if (arg === "--status") {
      const value = readValue(commandArgs, index, arg);
      if (value !== "blocked" && value !== "needs-human-review") throw new MissionCommandError(`Unsupported mission mark status: ${value}`);
      markStatus = value;
      index += 1;
      continue;
    }
    if (arg.startsWith("--")) throw new MissionCommandError(`Unknown mission option: ${arg}`);
    if (!file) {
      file = arg;
      continue;
    }
    throw new MissionCommandError(`Unexpected mission argument: ${arg}`);
  }

  if (!file) throw new MissionCommandError(`Missing mission input file.\n\n${MISSION_HELP}`);
  if (action !== "rerun" && action !== "mark" && taskId) throw new MissionCommandError(`--task is only supported for mission mark/rerun.`);
  if (action === "rerun" && !taskId) throw new MissionCommandError(`mission rerun requires --task <id>.`);
  if (action !== "mark" && markStatus) throw new MissionCommandError(`--status is only supported for mission mark.`);
  if (action === "mark" && (!taskId || !markStatus)) throw new MissionCommandError(`mission mark requires --task <id> --status <blocked|needs-human-review>.`);
  return { action, file, dryRun, continueOnError, json, slug, summaryPath, taskId, markStatus, codexArgs };
}

function missionCounts(tasks: MissionTask[]): MissionSummary["counts"] {
  return {
    total: tasks.length,
    planned: tasks.filter((task) => task.status === "planned").length,
    passed: tasks.filter((task) => task.status === "passed").length,
    failed: tasks.filter((task) => task.status === "failed").length,
    skipped: tasks.filter((task) => task.status === "skipped").length,
    blocked: tasks.filter((task) => task.status === "blocked").length,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run one mission file per invocation
  2. Quote file paths containing spaces
  3. Loop over files in a shell script if you need batch behavior

Example fix

# before
mission run a.md b.md
# after
for f in a.md b.md; do mission run "$f"; done
Defensive patterns

Strategy: validation

Validate before calling

const positional = args.filter(a => !a.startsWith('--') && !isAction(a));
if (positional.length > 1) failEarly('one file only');

Prevention

When it happens

Trigger: `mission run a.md b.md` — the second positional argument b.md triggers it. Also any bare token after the file.

Common situations: Passing multiple mission files at once expecting batch execution; a stray unquoted filename containing a space splitting into two tokens.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/708cf9c6d030309a. Report an issue: GitHub.