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

No autoresearch-goal mission found at ${repoRelative(cwd, pa

Error message

No autoresearch-goal mission found at ${repoRelative(cwd, path)}. Run `omx autoresearch-goal create ...` first.

What it means

Thrown by readAutoresearchGoal when the autoresearch-goal mission JSON file cannot be read at the expected path (.omx mission path derived from the slugified mission name). It means no mission has been created (or it was moved/renamed) for that slug under the current working directory.

Source

Thrown at src/autoresearch/goal.ts:179

    completion_path: repoRelative(cwd, autoresearchGoalCompletionPath(cwd, slug)),
  };

  await mkdir(autoresearchGoalDir(cwd, slug), { recursive: true });
  await writeFile(autoresearchGoalRubricPath(cwd, slug), `${rubric}\n`, 'utf-8');
  await writeFile(autoresearchGoalLedgerPath(cwd, slug), '', 'utf-8');
  await writeMission(cwd, mission);
  await appendLedger(cwd, slug, { ts: now, event: 'workflow_created', slug, status: mission.status, message: `Autoresearch goal created: ${topic}` });
  return mission;
}

export async function readAutoresearchGoal(cwd: string, slug: string): Promise<AutoresearchGoalMission> {
  const normalizedSlug = slugifyMissionName(slug);
  const path = autoresearchGoalMissionPath(cwd, normalizedSlug);
  let raw: string;
  try {
    raw = await readFile(path, 'utf-8');
  } catch {
    throw new AutoresearchGoalError(`No autoresearch-goal mission found at ${repoRelative(cwd, path)}. Run \`omx autoresearch-goal create ...\` first.`);
  }
  const parsed = JSON.parse(raw) as AutoresearchGoalMission;
  if (parsed.schema_version !== 1 || parsed.workflow !== 'autoresearch-goal') {
    throw new AutoresearchGoalError(`Invalid autoresearch-goal mission at ${repoRelative(cwd, path)}.`);
  }
  return parsed;
}

export async function readAutoresearchGoalCompletion(cwd: string, slug: string): Promise<AutoresearchGoalCompletion | null> {
  const path = autoresearchGoalCompletionPath(cwd, slugifyMissionName(slug));
  if (!existsSync(path)) return null;
  const parsed = JSON.parse(await readFile(path, 'utf-8')) as AutoresearchGoalCompletion;
  return parsed;
}

export async function recordAutoresearchGoalVerdict(
  cwd: string,
  options: RecordAutoresearchGoalVerdictOptions,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run `omx autoresearch-goal create ...` first to create the mission for that slug
  2. Verify you are running from the repository root where the mission was created (the path is cwd-relative)
  3. Check the slug spelling and how slugifyMissionName transforms it, and confirm the file exists at the printed repo-relative path
  4. If the mission file was deleted or never committed, recreate it with `omx autoresearch-goal create`

Example fix

// before
await recordAutoresearchGoalVerdict(repoRoot, { slug: 'fix-leak', evidence: '...' }); // throws: no mission found
// after
await createAutoresearchGoal(repoRoot, { /* ... */ }); // `omx autoresearch-goal create ...`
await recordAutoresearchGoalVerdict(repoRoot, { slug: 'fix-leak', evidence: '...' });
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
import { join } from 'node:path';
// mirror the mission path layout before calling goal APIs
const missionFile = join(cwd, '.omx', 'autoresearch-goal', `${slugifyMissionName(slug)}.json`);
if (!existsSync(missionFile)) {
  throw new Error(`Mission ${slug} not created yet; run create first.`);
}

Type guard

function isAutoresearchGoalMissionDoc(v: unknown): v is { schema_version: number; workflow: string; slug: string } {
  return typeof v === 'object' && v !== null &&
    (v as any).workflow === 'autoresearch-goal' &&
    (v as any).schema_version === 1;
}

Try / catch

try {
  const mission = await readAutoresearchGoal(cwd, slug);
} catch (e) {
  if (e instanceof AutoresearchGoalError && e.message.includes('No autoresearch-goal mission found')) {
    // create the mission then retry once
  } else throw e;
}

Prevention

When it happens

Trigger: Calling an API that internally calls readAutoresearchGoal(cwd, slug) (e.g. the mission command, recordAutoresearchGoalVerdict, completeAutoresearchGoal) before ever running `omx autoresearch-goal create`, or passing a slug that slugifies to a different filename than the one on disk.

Common situations: Running verdict/completion commands from the wrong repository root (cwd mismatch), renaming the mission directory manually, typos in the slug, or assuming a mission exists after a fresh clone without committing .omx state.

Related errors


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