{"record":{"id":"c20c9a1d67417c89","repo":"Yeachan-Heo/oh-my-codex","slug":"ask-advisor-script-not-found-advisorscriptpat","errorCode":null,"errorMessage":"[ask] advisor script not found: ${advisorScriptPath}","messagePattern":"\\[ask\\] advisor script not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/cli/ask.ts","lineNumber":181,"sourceCode":"  if (typeof signalNumber === 'number' && Number.isFinite(signalNumber)) {\n    return 128 + signalNumber;\n  }\n  return 1;\n}\n\nexport async function askCommand(args: string[]): Promise<void> {\n  if (args[0] === '--help' || args[0] === '-h') {\n    console.log(ASK_USAGE);\n    return;\n  }\n\n  const parsed = parseAskArgs(args);\n  const packageRoot = getPackageRoot();\n  const advisorScriptPath = resolveAskAdvisorScriptPath(packageRoot);\n  const promptsDir = resolveAskPromptsDir(process.cwd(), process.env);\n\n  if (!existsSync(advisorScriptPath)) {\n    throw new Error(`[ask] advisor script not found: ${advisorScriptPath}`);\n  }\n\n  let finalPrompt = parsed.prompt;\n  if (parsed.agentPromptRole) {\n    const agentPromptContent = await resolveAgentPromptContent(parsed.agentPromptRole, promptsDir);\n    finalPrompt = `${agentPromptContent}\\n\\n${parsed.prompt}`;\n  }\n\n  const child = spawnSync(\n    process.execPath,\n    [advisorScriptPath, parsed.provider, finalPrompt],\n    {\n      cwd: process.cwd(),\n      env: {\n        ...process.env,\n        [ASK_ORIGINAL_TASK_ENV]: parsed.prompt,\n      },\n      stdio: ['ignore', 'pipe', 'pipe'],","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/ask.ts#L163-L199","documentation":"`omx ask` shells out to an advisor script (resolved relative to the package root via resolveAskAdvisorScriptPath). Before spawning, it verifies the script file exists; if the packaged script is missing the command aborts with this error. This almost always indicates a broken or stripped installation.","triggerScenarios":"Running `omx ask ...` when the advisor script (e.g. dist/ask-advisor.js) is absent from the installed package — corrupted node_modules, an incomplete publish, or files stripped by a bundler/Docker multi-stage copy.","commonSituations":"Docker images copying only package.json without dist; .npmignore/files field accidentally excluding the script; node_modules pruned by dedupe tools; partially interrupted npm install.","solutions":["Reinstall the package cleanly: remove node_modules and package-lock, then `npm install`","If building a container, ensure the package's full dist output is copied, not just metadata","Verify the printed path exists on disk and inspect why it's missing (npm pack contents)","Pin/downgrade to a known-good published version if the latest release is broken"],"exampleFix":"# before\n# advisor script missing after partial install\nomx ask \"question\"\n# after\nrm -rf node_modules package-lock.json && npm install\nomx ask \"question\"","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync(join(pkgRoot, 'dist', 'ask-advisor.js'))) {\n  await reinstallPackage();\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (/advisor script not found/.test(String(e))) { await reinstallOmx(); retry(); } else throw e; }","preventionTips":["Copy full package dist output into Docker images","Verify install integrity after node_modules pruning","Smoke-test `omx ask` in CI images"],"tags":["ask","missing-file","installation","advisor-script"],"backgroundTag":"missing-packaged-file","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}