{"record":{"id":"33fd5ae44738a2e5","repo":"Yeachan-Heo/oh-my-codex","slug":"unable-to-resolve-omx-launcher-path-for-exec","errorCode":null,"errorMessage":"Unable to resolve OMX launcher path for exec","messagePattern":"Unable to resolve OMX launcher path for exec","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":4255,"sourceCode":"        `[omx] preLaunch abort cleanup warning: ${cleanupErr instanceof Error ? cleanupErr.message : cleanupErr}`,\n      );\n    });\n    throw err;\n  }\n\n  try {\n    const notifyTempContractRaw = notifyTempResult.contract.active\n      ? serializeNotifyTempContract(notifyTempResult.contract)\n      : null;\n    const codexArgs = injectModelInstructionsBypassArgs(\n      cwd,\n      [\"exec\", ...normalizedArgs],\n      process.env,\n      sessionModelInstructionsPath(cwd, sessionId),\n    );\n    const omxRootOverride = resolveOmxRootForLaunch(cwd, process.env);\n    const omxBin = resolveOmxCliEntryPath({ argv1: process.argv[1], cwd, env: process.env });\n    if (!omxBin) throw new Error(\"Unable to resolve OMX launcher path for exec\");\n    const hudRuntimeRoot = resolveHudRuntimeRootForLaunch(cwd, process.env);\n    const codexEnvBase = prependOmxRuntimeCommandShimToEnv(\n      cwd,\n      {\n        ...stripHermesMcpBridgeEnv(process.env),\n        ...(codexHomeOverride ? { CODEX_HOME: codexHomeOverride } : {}),\n        ...(sqliteHomeOverride ? { [CODEX_SQLITE_HOME_ENV]: sqliteHomeOverride } : {}),\n        ...(omxRootOverride ? { OMX_ROOT: omxRootOverride } : {}),\n      },\n      omxBin,\n    );\n    // Correlates plugin hook routing only; it is not an authority token.\n    const pluginHookRoutingLaunchId = randomUUID();\n    const codexEnv = {\n      ...codexEnvBase,\n      OMX_CODEX_LAUNCH_ID: pluginHookRoutingLaunchId,\n      ...buildHudRuntimeEnv({ sessionId, ...hudRuntimeRoot }).env,\n      ...(notifyTempContractRaw ? { [OMX_NOTIFY_TEMP_CONTRACT_ENV]: notifyTempContractRaw } : {}),","sourceCodeStart":4237,"sourceCodeEnd":4273,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L4237-L4273","documentation":"Thrown when the launcher cannot determine the absolute path to its own CLI entry script ('omx' bin) before spawning an exec-mode Codex child. The exec wrapper needs the launcher path to re-invoke OMX inside the child (e.g. for the runtime command shim), so an unresolvable path is fatal to exec delegation.","triggerScenarios":"resolveOmxCliEntryPath returns falsy when argv[1] does not point at a resolvable OMX entry file — running via a mechanism that rewrites argv (some wrappers, bundled binaries, eval-style loaders), a missing/moved node_modules/omx install, or a cwd/env combination where module resolution of the entry fails.","commonSituations":"Installing via unusual package managers that symlink oddly (pnpm shims, npx cache runs), running from a global install whose real path differs from argv1, running inside containers or bundlers where require.resolve of the entry fails, or partial/corrupted installs.","solutions":["Reinstall OMX cleanly (npm i -g omx or via the documented installer) so the bin shim and entry file are consistent","Run through the documented bin entry (the omx command) rather than importing internals or wrapping with custom loaders","Check that process.argv[1] resolves to a real file on disk from your cwd; if wrapping, set argv/env so the entry path is discoverable","Avoid running under bundlers or tsx/node loaders that rewrite argv without preserving the entry module"],"exampleFix":"// before\n$ node -e \"require('/opt/omx/dist/cli/index.js')('exec', ...)\n\n// after\n$ omx exec ... // use the installed bin so argv1 resolves the OMX entry","handlingStrategy":"validation","validationCode":"import { resolveOmxCliEntryPath } from \"omx\";\nconst bin = resolveOmxCliEntryPath({ argv1: process.argv[1], cwd: process.cwd(), env: process.env });\nif (!bin) { /* fall back to plain codex invocation or abort */ }","typeGuard":null,"tryCatchPattern":"try { await omxExec(args); } catch (e) { if (e instanceof Error && /OMX launcher path/.test(e.message)) { /* reinstall or run via the omx bin */ } throw e; }","preventionTips":["Install OMX through its supported installer and invoke the omx binary directly","Verify `which omx` resolves to an existing file after upgrades","Avoid wrappers/bundlers that rewrite process.argv[1]"],"tags":["path-resolution","exec","launcher","install"],"backgroundTag":"module-entry-unresolvable","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}