{"record":{"id":"f54b9ba42e1c92d8","repo":"Yeachan-Heo/oh-my-codex","slug":"ask-prompts-directory-not-found-promptsdir","errorCode":null,"errorMessage":"[ask] prompts directory not found: ${promptsDir}. Run \"omx setup\" to install prompts.","messagePattern":"\\[ask\\] prompts directory not found: (.+?)\\. Run \"omx setup\" to install prompts\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/ask.ts","lineNumber":67,"sourceCode":"    }\n  } catch {\n    // Ignore malformed persisted scope and fall back to user prompts.\n  }\n\n  return codexPromptsDir();\n}\n\nasync function resolveAgentPromptContent(\n  role: string,\n  promptsDir: string,\n): Promise<string> {\n  const normalizedRole = role.trim().toLowerCase();\n  if (!SAFE_ROLE_PATTERN.test(normalizedRole)) {\n    throw new Error(`[ask] invalid --agent-prompt role \"${role}\". Expected lowercase role names like \"executor\" or \"test-engineer\".`);\n  }\n\n  if (!existsSync(promptsDir)) {\n    throw new Error(`[ask] prompts directory not found: ${promptsDir}. Run \"omx setup\" to install prompts.`);\n  }\n\n  const promptPath = join(promptsDir, `${normalizedRole}.md`);\n  if (!existsSync(promptPath)) {\n    const files = await readdir(promptsDir).catch(() => [] as string[]);\n    const availableRoles = files\n      .filter((file) => file.endsWith('.md'))\n      .map((file) => file.slice(0, -3))\n      .sort();\n    const availableSuffix = availableRoles.length > 0\n      ? ` Available roles: ${availableRoles.join(', ')}.`\n      : '';\n    throw new Error(`[ask] --agent-prompt role \"${normalizedRole}\" not found in ${promptsDir}.${availableSuffix}`);\n  }\n\n  const content = (await readFile(promptPath, 'utf-8')).trim();\n  if (!content) {\n    throw new Error(`[ask] --agent-prompt role \"${normalizedRole}\" is empty: ${promptPath}`);","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/ask.ts#L49-L85","documentation":"After the role passes format validation, `omx ask` checks that the prompts directory exists (where role .md prompt files live, resolved from cwd/env). If the directory is missing — typically because prompts were never installed — this error suggests running `omx setup`, which installs the prompt files.","triggerScenarios":"Running `omx ask --agent-prompt executor ...` in an environment where the prompts directory has not been created (fresh install, no `omx setup` run yet, or wrong cwd so the resolved prompts dir points somewhere that lacks it).","commonSituations":"Fresh clones or containers where setup was skipped; running omx from a directory where env-based prompts dir resolution points to a non-existent path; prompts dir deleted or excluded from deployment.","solutions":["Run `omx setup` to install the prompts directory","Verify you are running from the intended project directory (prompts dir resolution depends on cwd/env)","Check any env var that overrides the prompts directory location and correct it","Reinstall the omx package if prompts were expected to ship with it"],"exampleFix":"# before\nomx ask --agent-prompt executor \"task\"\n# after\nomx setup\nomx ask --agent-prompt executor \"task\"","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync(promptsDir)) {\n  await exec('omx setup'); // ensure prompts installed\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (/prompts directory not found/.test(String(e))) { await runSetup(); retry(); } else throw e; }","preventionTips":["Run `omx setup` during environment bootstrap","Verify cwd/env-based prompts dir resolution before scripted runs","Include prompts in deployment artifacts"],"tags":["ask","setup","missing-directory","prompts"],"backgroundTag":"missing-directory","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}