Yeachan-Heo/oh-my-codex · error · Error
[ask] prompts directory not found: ${promptsDir}. Run "omx s
Error message
[ask] prompts directory not found: ${promptsDir}. Run "omx setup" to install prompts. What it means
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.
Source
Thrown at src/cli/ask.ts:67
}
} catch {
// Ignore malformed persisted scope and fall back to user prompts.
}
return codexPromptsDir();
}
async function resolveAgentPromptContent(
role: string,
promptsDir: string,
): Promise<string> {
const normalizedRole = role.trim().toLowerCase();
if (!SAFE_ROLE_PATTERN.test(normalizedRole)) {
throw new Error(`[ask] invalid --agent-prompt role "${role}". Expected lowercase role names like "executor" or "test-engineer".`);
}
if (!existsSync(promptsDir)) {
throw new Error(`[ask] prompts directory not found: ${promptsDir}. Run "omx setup" to install prompts.`);
}
const promptPath = join(promptsDir, `${normalizedRole}.md`);
if (!existsSync(promptPath)) {
const files = await readdir(promptsDir).catch(() => [] as string[]);
const availableRoles = files
.filter((file) => file.endsWith('.md'))
.map((file) => file.slice(0, -3))
.sort();
const availableSuffix = availableRoles.length > 0
? ` Available roles: ${availableRoles.join(', ')}.`
: '';
throw new Error(`[ask] --agent-prompt role "${normalizedRole}" not found in ${promptsDir}.${availableSuffix}`);
}
const content = (await readFile(promptPath, 'utf-8')).trim();
if (!content) {
throw new Error(`[ask] --agent-prompt role "${normalizedRole}" is empty: ${promptPath}`);View on GitHub (pinned to 3ad79a8a6f)
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
Example fix
# before omx ask --agent-prompt executor "task" # after omx setup omx ask --agent-prompt executor "task"
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'node:fs';
if (!existsSync(promptsDir)) {
await exec('omx setup'); // ensure prompts installed
} Try / catch
catch (e) { if (/prompts directory not found/.test(String(e))) { await runSetup(); retry(); } else throw e; } Prevention
- Run `omx setup` during environment bootstrap
- Verify cwd/env-based prompts dir resolution before scripted runs
- Include prompts in deployment artifacts
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- [ask] --agent-prompt role "${normalizedRole}" not found in $
- [ask] --agent-prompt role "${normalizedRole}" is empty: ${pr
- autoresearch_resume_missing_worktree
- [ask] invalid --agent-prompt role "${role}". Expected lowerc
- [ask] advisor script not found: ${advisorScriptPath}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/f54b9ba42e1c92d8.
Report an issue: GitHub.