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

[ask] failed to launch advisor script: ${child.error.message

Error message

[ask] failed to launch advisor script: ${child.error.message}

What it means

After running the advisor script synchronously, `omx ask` inspects the child result. If `child.error` is set, the script process never launched successfully (spawn-level failure, not a non-zero exit) and the raw error message is surfaced. This is the same family as spawn ENOENT/EACCES but for the advisor script specifically.

Source

Thrown at src/cli/ask.ts:211

    {
      cwd: process.cwd(),
      env: {
        ...process.env,
        [ASK_ORIGINAL_TASK_ENV]: parsed.prompt,
      },
      stdio: ['ignore', 'pipe', 'pipe'],
    },
  );

  if (child.stdout && child.stdout.length > 0) {
    process.stdout.write(child.stdout);
  }
  if (child.stderr && child.stderr.length > 0) {
    process.stderr.write(child.stderr);
  }

  if (child.error) {
    throw new Error(`[ask] failed to launch advisor script: ${child.error.message}`);
  }

  const status = typeof child.status === 'number'
    ? child.status
    : resolveSignalExitCode(child.signal);

  if (status !== 0) {
    process.exitCode = status;
  }
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Read the appended message: ENOENT → script vanished (reinstall); EACCES → chmod +x or fix permissions; otherwise address the OS error
  2. Reinstall the package to restore a consistent dist tree
  3. Ensure `node` is resolvable in the environment where omx runs
  4. Retry once — existsSync-then-spawn races are transient during concurrent upgrades
Defensive patterns

Strategy: retry

Validate before calling

import { existsSync } from 'node:fs';
if (!existsSync(advisorScriptPath)) throw new Error('advisor script vanished; reinstall omx');

Try / catch

catch (e) { if (/failed to launch advisor script/.test(String(e))) { await reinstallOmx(); retry(); } else throw e; }

Prevention

When it happens

Trigger: The advisor script file was deleted between the existsSync check and spawn, its Node interpreter or shebang is unavailable, or OS permissions/sandboxing block execution.

Common situations: AVIF/AV software locking or removing the script; node not on PATH for the spawn context in containers; noexec mounts; race with package upgrades replacing dist files mid-run.

Related errors


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