{"record":{"id":"992a58d1e03a62d2","repo":"Yeachan-Heo/oh-my-codex","slug":"unable-to-resolve-omx-cli-entry-path-for-question","errorCode":null,"errorMessage":"Unable to resolve OMX CLI entry path for question UI launch.","messagePattern":"Unable to resolve OMX CLI entry path for question UI launch\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/question/renderer.ts","lineNumber":344,"sourceCode":"    target: paneId,\n    launched_at: launchedAt,\n    ...(returnTarget ? { return_target: returnTarget, return_transport: 'tmux-send-keys' as const } : {}),\n  };\n}\n\nfunction resolveQuestionUiProcessArgs(\n  recordPath: string,\n  options: {\n    cwd: string;\n    env?: NodeJS.ProcessEnv;\n  },\n): string[] {\n  const omxBin = resolveOmxCliEntryPath({\n    argv1: process.argv[1],\n    cwd: options.cwd,\n    env: options.env,\n  }) || process.argv[1];\n  if (!omxBin) throw new Error('Unable to resolve OMX CLI entry path for question UI launch.');\n  return [omxBin, 'question', '--ui', '--state-path', recordPath];\n}\n\nexport function buildQuestionUiTmuxArgs(\n  recordPath: string,\n  options: {\n    cwd: string;\n    env?: NodeJS.ProcessEnv;\n    sessionId?: string;\n    returnTarget?: string;\n    underCmux?: boolean;\n  },\n): string[] {\n  const envEntries: Array<[string, string]> = [];\n  if (options.sessionId) envEntries.push(['OMX_SESSION_ID', options.sessionId]);\n  if (options.returnTarget) {\n    envEntries.push(['OMX_QUESTION_RETURN_TARGET', options.returnTarget]);\n    envEntries.push(['OMX_QUESTION_RETURN_TRANSPORT', 'tmux-send-keys']);","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/question/renderer.ts#L326-L362","documentation":"resolveQuestionUiProcessArgs needs a path to the OMX CLI executable to spawn the question UI. It first tries resolveOmxCliEntryPath (using process.argv[1], cwd, env) and falls back to process.argv[1]; if both are empty (no fallback available), it throws. This happens when the process was launched in a way that argv[1] is unset and the resolver cannot locate the entry file.","triggerScenarios":"process.argv[1] empty (e.g. embedded node, `node -e`, a REPL, or a bundled runtime) AND resolveOmxCliEntryPath returning null because cwd/env do not contain the expected CLI layout. Typical in Electron-style hosts, Codex App integration, or tests that stub argv.","commonSituations":"Running omx as a library from a custom host rather than the installed CLI; cwd changed to a directory without the CLI package; packaging (pkg/bun single-file) that removes the real entry path.","solutions":["Run the question UI via the installed omx CLI itself so process.argv[1] points at the entry file.","If embedding, pass options.cwd/options.env that let resolveOmxCliEntryPath find the CLI package (e.g. cwd inside the package or an env var pointing to it).","Check process.argv[1] is non-empty in your host before calling launchQuestionRenderer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!process.argv[1]) throw new Error('cannot launch question UI: host has no argv[1] CLI entry');","typeGuard":null,"tryCatchPattern":"try { resolveQuestionUiProcessArgs(recordPath, opts); } catch (e) { if (e instanceof Error && /OMX CLI entry path/.test(e.message)) { /* pass explicit cwd/env pointing at the installed CLI package */ } else throw e; }","preventionTips":["Launch the question UI from the real installed omx CLI, not an embedded host.","Keep cwd inside the CLI package or export env hints the resolver uses.","Add a startup assertion that argv[1] exists in custom hosts."],"tags":["cli-path","environment","renderer"],"backgroundTag":"executable-path-resolution-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}