Yeachan-Heo/oh-my-codex · critical · Error

[ask] advisor script not found: ${advisorScriptPath}

Error message

[ask] advisor script not found: ${advisorScriptPath}

What it means

`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.

Source

Thrown at src/cli/ask.ts:181

  if (typeof signalNumber === 'number' && Number.isFinite(signalNumber)) {
    return 128 + signalNumber;
  }
  return 1;
}

export async function askCommand(args: string[]): Promise<void> {
  if (args[0] === '--help' || args[0] === '-h') {
    console.log(ASK_USAGE);
    return;
  }

  const parsed = parseAskArgs(args);
  const packageRoot = getPackageRoot();
  const advisorScriptPath = resolveAskAdvisorScriptPath(packageRoot);
  const promptsDir = resolveAskPromptsDir(process.cwd(), process.env);

  if (!existsSync(advisorScriptPath)) {
    throw new Error(`[ask] advisor script not found: ${advisorScriptPath}`);
  }

  let finalPrompt = parsed.prompt;
  if (parsed.agentPromptRole) {
    const agentPromptContent = await resolveAgentPromptContent(parsed.agentPromptRole, promptsDir);
    finalPrompt = `${agentPromptContent}\n\n${parsed.prompt}`;
  }

  const child = spawnSync(
    process.execPath,
    [advisorScriptPath, parsed.provider, finalPrompt],
    {
      cwd: process.cwd(),
      env: {
        ...process.env,
        [ASK_ORIGINAL_TASK_ENV]: parsed.prompt,
      },
      stdio: ['ignore', 'pipe', 'pipe'],

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Reinstall the package cleanly: remove node_modules and package-lock, then `npm install`
  2. If building a container, ensure the package's full dist output is copied, not just metadata
  3. Verify the printed path exists on disk and inspect why it's missing (npm pack contents)
  4. Pin/downgrade to a known-good published version if the latest release is broken

Example fix

# before
# advisor script missing after partial install
omx ask "question"
# after
rm -rf node_modules package-lock.json && npm install
omx ask "question"
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
if (!existsSync(join(pkgRoot, 'dist', 'ask-advisor.js'))) {
  await reinstallPackage();
}

Try / catch

catch (e) { if (/advisor script not found/.test(String(e))) { await reinstallOmx(); retry(); } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/c20c9a1d67417c89. Report an issue: GitHub.