{"record":{"id":"b78d1ecfbde51d1e","repo":"Yeachan-Heo/oh-my-codex","slug":"ask-agent-prompt-role-normalizedrole-is-e","errorCode":null,"errorMessage":"[ask] --agent-prompt role \"${normalizedRole}\" is empty: ${promptPath}","messagePattern":"\\[ask\\] --agent-prompt role \"(.+?)\" is empty: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/ask.ts","lineNumber":85,"sourceCode":"    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}`);\n  }\n\n  return content;\n}\n\nexport function parseAskArgs(args: readonly string[]): ParsedAskArgs {\n  const [providerRaw, ...rest] = args;\n  const provider = (providerRaw || '').toLowerCase();\n\n  if (!provider || !ASK_PROVIDER_SET.has(provider)) {\n    throw askUsageError(`Invalid provider \"${providerRaw || ''}\". Expected one of: ${ASK_PROVIDERS.join(', ')}.`);\n  }\n\n  if (rest.length === 0) {\n    throw askUsageError('Missing prompt text.');\n  }\n\n  let agentPromptRole: string | undefined;","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/ask.ts#L67-L103","documentation":"The requested role's prompt file exists but its contents are empty (or whitespace-only, since content is trimmed). `omx ask` refuses to use an empty prompt because concatenating it would silently produce a prompt with no role instructions.","triggerScenarios":"Passing `--agent-prompt <role>` where `<promptsDir>/<role>.md` exists but is 0 bytes or contains only whitespace/newlines.","commonSituations":"Placeholder files created but never filled in; prompt files truncated by a bad merge or editor; template scaffolding that creates empty stubs.","solutions":["Fill in the prompt file at the path shown in the error with actual role instructions","If the file is a leftover stub, delete it so the 'role not found' path guides you to valid roles instead","Check git status/history for accidental truncation of the prompt file"],"exampleFix":"# before\n# prompts/executor.md is empty\nomx ask --agent-prompt executor \"task\"\n# after\necho 'You are a careful executor agent...' > prompts/executor.md\nomx ask --agent-prompt executor \"task\"","handlingStrategy":"validation","validationCode":"import { readFileSync } from 'node:fs';\nconst content = readFileSync(join(promptsDir, role + '.md'), 'utf-8').trim();\nif (!content) throw new Error(`prompt file for '${role}' is empty`);","typeGuard":null,"tryCatchPattern":"catch (e) { if (/is empty:/.test(String(e))) { scaffoldDefaultPrompt(role); retry(); } else throw e; }","preventionTips":["Lint prompt files for non-empty content in CI","Use templates that ship with real content","Guard against truncated files after merges"],"tags":["ask","prompts","empty-file","validation"],"backgroundTag":"empty-configuration-file","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}