{"record":{"id":"f6054e1bf091ceaf","repo":"Yeachan-Heo/oh-my-codex","slug":"mission-dir-does-not-exist-missiondir","errorCode":null,"errorMessage":"mission-dir does not exist: ${missionDir}","messagePattern":"mission-dir does not exist: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/autoresearch/contracts.ts","lineNumber":215,"sourceCode":"\n  const result = parsed as Record<string, unknown>;\n  if (typeof result.pass !== 'boolean') {\n    throw contractError('Evaluator output must include boolean pass.');\n  }\n  if (result.score !== undefined && typeof result.score !== 'number') {\n    throw contractError('Evaluator output score must be numeric when provided.');\n  }\n\n  return {\n    pass: result.pass,\n    ...(result.score === undefined ? {} : { score: result.score }),\n  };\n}\n\nexport async function loadAutoresearchMissionContract(missionDirArg: string): Promise<AutoresearchMissionContract> {\n  const missionDir = resolve(missionDirArg);\n  if (!existsSync(missionDir)) {\n    throw contractError(`mission-dir does not exist: ${missionDir}`);\n  }\n\n  const repoRoot = readGit(missionDir, ['rev-parse', '--show-toplevel']);\n  ensurePathInside(repoRoot, missionDir);\n\n  const missionFile = join(missionDir, 'mission.md');\n  const sandboxFile = join(missionDir, 'sandbox.md');\n  if (!existsSync(missionFile)) {\n    throw contractError(`mission.md is required inside mission-dir: ${missionFile}`);\n  }\n  if (!existsSync(sandboxFile)) {\n    throw contractError(`sandbox.md is required inside mission-dir: ${sandboxFile}`);\n  }\n\n  const missionContent = await readFile(missionFile, 'utf-8');\n  const sandboxContent = await readFile(sandboxFile, 'utf-8');\n  const sandbox = parseSandboxContract(sandboxContent);\n  const missionRelativeDir = relative(repoRoot, missionDir) || basename(missionDir);","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/autoresearch/contracts.ts#L197-L233","documentation":"loadAutoresearchMissionContract resolves the mission-dir argument and immediately throws if existsSync fails — the directory must already exist on disk before the contract can be loaded. The resolved absolute path is included in the message.","triggerScenarios":"Passing a relative or absolute mission-dir path that does not exist: typos, wrong working directory for relative paths, or the directory not yet created/synced.","commonSituations":"CLI --mission-dir typos; running from a different cwd so a relative path resolves elsewhere; directories not yet mounted in containers or not checked out in CI.","solutions":["Check the path for typos and pass the correct absolute path.","If using a relative path, confirm the process cwd or resolve it yourself before calling.","Create/clone the mission directory (and commit it) if it should exist; verify in CI checkout steps."],"exampleFix":"// before\nconst contract = await loadAutoresearchMissionContract('missions/m1-typo');\n\n// after\nconst missionDir = resolve('missions/m1');\nif (!existsSync(missionDir)) throw new Error(`setup missing: ${missionDir}`);\nconst contract = await loadAutoresearchMissionContract(missionDir);","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nconst missionDir = resolve(missionDirArg);\nif (!existsSync(missionDir)) {\n  throw new Error(`Mission dir missing: ${missionDir} — create or fix the path`);\n}\nconst contract = await loadAutoresearchMissionContract(missionDir);","typeGuard":null,"tryCatchPattern":"try {\n  await loadAutoresearchMissionContract(dir);\n} catch (err) {\n  if ((err as Error).message.includes('mission-dir does not exist')) {\n    // prompt the user for the correct path or create/clone the mission\n  }\n  throw err;\n}","preventionTips":["Resolve mission-dir to an absolute path before calling.","Validate user-supplied paths with existsSync and give an early, clearer error.","In CI, verify the mission dir is checked out before the run."],"tags":["filesystem","mission-dir","path-validation"],"backgroundTag":"directory-not-found","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}