{"record":{"id":"39518fc50881d171","repo":"Yeachan-Heo/oh-my-codex","slug":"no-autoresearch-goal-mission-found-at-reporelati","errorCode":null,"errorMessage":"No autoresearch-goal mission found at ${repoRelative(cwd, path)}. Run `omx autoresearch-goal create ...` first.","messagePattern":"No autoresearch-goal mission found at (.+?)\\. Run `omx autoresearch-goal create \\.\\.\\.` first\\.","errorType":"validation","errorClass":"AutoresearchGoalError","httpStatus":null,"severity":"error","filePath":"src/autoresearch/goal.ts","lineNumber":179,"sourceCode":"    completion_path: repoRelative(cwd, autoresearchGoalCompletionPath(cwd, slug)),\n  };\n\n  await mkdir(autoresearchGoalDir(cwd, slug), { recursive: true });\n  await writeFile(autoresearchGoalRubricPath(cwd, slug), `${rubric}\\n`, 'utf-8');\n  await writeFile(autoresearchGoalLedgerPath(cwd, slug), '', 'utf-8');\n  await writeMission(cwd, mission);\n  await appendLedger(cwd, slug, { ts: now, event: 'workflow_created', slug, status: mission.status, message: `Autoresearch goal created: ${topic}` });\n  return mission;\n}\n\nexport async function readAutoresearchGoal(cwd: string, slug: string): Promise<AutoresearchGoalMission> {\n  const normalizedSlug = slugifyMissionName(slug);\n  const path = autoresearchGoalMissionPath(cwd, normalizedSlug);\n  let raw: string;\n  try {\n    raw = await readFile(path, 'utf-8');\n  } catch {\n    throw new AutoresearchGoalError(`No autoresearch-goal mission found at ${repoRelative(cwd, path)}. Run \\`omx autoresearch-goal create ...\\` first.`);\n  }\n  const parsed = JSON.parse(raw) as AutoresearchGoalMission;\n  if (parsed.schema_version !== 1 || parsed.workflow !== 'autoresearch-goal') {\n    throw new AutoresearchGoalError(`Invalid autoresearch-goal mission at ${repoRelative(cwd, path)}.`);\n  }\n  return parsed;\n}\n\nexport async function readAutoresearchGoalCompletion(cwd: string, slug: string): Promise<AutoresearchGoalCompletion | null> {\n  const path = autoresearchGoalCompletionPath(cwd, slugifyMissionName(slug));\n  if (!existsSync(path)) return null;\n  const parsed = JSON.parse(await readFile(path, 'utf-8')) as AutoresearchGoalCompletion;\n  return parsed;\n}\n\nexport async function recordAutoresearchGoalVerdict(\n  cwd: string,\n  options: RecordAutoresearchGoalVerdictOptions,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/autoresearch/goal.ts#L161-L197","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `omx autoresearch-goal create ...` first to create the mission for that slug","Verify you are running from the repository root where the mission was created (the path is cwd-relative)","Check the slug spelling and how slugifyMissionName transforms it, and confirm the file exists at the printed repo-relative path","If the mission file was deleted or never committed, recreate it with `omx autoresearch-goal create`"],"exampleFix":"// before\nawait recordAutoresearchGoalVerdict(repoRoot, { slug: 'fix-leak', evidence: '...' }); // throws: no mission found\n// after\nawait createAutoresearchGoal(repoRoot, { /* ... */ }); // `omx autoresearch-goal create ...`\nawait recordAutoresearchGoalVerdict(repoRoot, { slug: 'fix-leak', evidence: '...' });","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\n// mirror the mission path layout before calling goal APIs\nconst missionFile = join(cwd, '.omx', 'autoresearch-goal', `${slugifyMissionName(slug)}.json`);\nif (!existsSync(missionFile)) {\n  throw new Error(`Mission ${slug} not created yet; run create first.`);\n}","typeGuard":"function isAutoresearchGoalMissionDoc(v: unknown): v is { schema_version: number; workflow: string; slug: string } {\n  return typeof v === 'object' && v !== null &&\n    (v as any).workflow === 'autoresearch-goal' &&\n    (v as any).schema_version === 1;\n}","tryCatchPattern":"try {\n  const mission = await readAutoresearchGoal(cwd, slug);\n} catch (e) {\n  if (e instanceof AutoresearchGoalError && e.message.includes('No autoresearch-goal mission found')) {\n    // create the mission then retry once\n  } else throw e;\n}","preventionTips":["Create the mission with `omx autoresearch-goal create` before any verdict/completion step","Always invoke goal APIs from the repository root where the mission was created","Treat slug spelling carefully; the filename is the slugified mission name"],"tags":["autoresearch","mission","missing-file","workflow-state"],"backgroundTag":"missing-workflow-state-file","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}