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

Invalid mission summary at ${summaryPath}.

Error message

Invalid mission summary at ${summaryPath}.

What it means

readSummary read the file but JSON.parse failed — the summary file is not valid JSON. This indicates a corrupted or hand-edited summary, or a non-summary file at the expected path.

Source

Thrown at src/cli/mission.ts:296

  const summaryPath = parsed.summaryPath
    ? (isAbsolute(parsed.summaryPath) ? parsed.summaryPath : resolve(cwd, parsed.summaryPath))
    : join(missionRoot, "summary.json");
  const ledgerPath = join(missionRoot, "ledger.jsonl");
  return { inputPath, slug, missionRoot, summaryPath, ledgerPath };
}

async function readSummary(summaryPath: string): Promise<MissionSummary> {
  let raw: string;
  try {
    raw = await readFile(summaryPath, "utf-8");
  } catch {
    throw new MissionCommandError(`No mission summary found at ${summaryPath}.`);
  }
  let summary: MissionSummary;
  try {
    summary = JSON.parse(raw) as MissionSummary;
  } catch {
    throw new MissionCommandError(`Invalid mission summary at ${summaryPath}.`);
  }
  if (summary.version !== 1 || !Array.isArray(summary.tasks)) {
    throw new MissionCommandError(`Invalid mission summary at ${summaryPath}.`);
  }
  return summary;
}

function syncSummary(summary: MissionSummary, updates: Partial<Pick<MissionSummary, "status" | "dry_run" | "continue_on_error" | "codex_args">>): void {
  Object.assign(summary, updates);
  summary.counts = missionCounts(summary.tasks);
}

async function runSelectedTasks(
  summary: MissionSummary,
  paths: MissionPaths,
  parsed: ParsedMissionArgs,
  now: () => Date,
  stdout: (line: string) => void,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Re-run the mission to regenerate the summary
  2. Restore the summary from version control
  3. Validate the file with a JSON linter (e.g. jq . summary.json) and fix syntax

Example fix

# before (broken summary.json)
{"version": 1, "tasks": [ ... ],,}
# after
jq . .mission/summary.json   # find and fix the syntax error, or re-run: mission run mission.md
Defensive patterns

Strategy: validation

Validate before calling

JSON.parse(await readFile(summaryPath, 'utf-8')); // in try/catch before invoking mission commands

Try / catch

try { JSON.parse(raw); } catch { /* regenerate summary via mission run before proceeding */ }

Prevention

When it happens

Trigger: Truncated write (crash during persistSummary), manual editing introducing syntax errors, or a different JSON-incompatible file occupying the summary path.

Common situations: Process killed mid-write of the summary; merge conflicts in a committed summary file; editors leaving trailing commas or comments.

Related errors


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