{"record":{"id":"b053238be2755467","repo":"Yeachan-Heo/oh-my-codex","slug":"api-failed-to-launch-native-binary-errno-mess","errorCode":null,"errorMessage":"[api] failed to launch native binary: ${errno.message}","messagePattern":"\\[api\\] failed to launch native binary: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/cli/api.ts","lineNumber":223,"sourceCode":"  if (args.length === 0) return true;\n  return args.includes('--help') || args.includes('-h');\n}\n\nexport async function apiCommand(args: string[]): Promise<void> {\n  if (isHelpRequest(args)) {\n    console.log(API_USAGE);\n    return;\n  }\n\n  const binaryPath = await resolveApiBinaryPathWithHydration();\n\n  const result = runApiBinary(binaryPath, args);\n  if (result.error) {\n    const errno = result.error as NodeJS.ErrnoException;\n    const kind = classifySpawnError(errno);\n    if (kind === 'missing') throw new Error(`[api] failed to launch native binary: executable not found (${binaryPath})`);\n    if (kind === 'blocked') throw new Error(`[api] failed to launch native binary: executable is blocked (${errno.code || 'blocked'})`);\n    throw new Error(`[api] failed to launch native binary: ${errno.message}`);\n  }\n\n  writeApiResultOutput(result);\n  if (result.status !== 0) {\n    process.exitCode = typeof result.status === 'number'\n      ? result.status\n      : resolveSignalExitCode(result.signal);\n  }\n}\n","sourceCodeStart":205,"sourceCodeEnd":233,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/api.ts#L205-L233","documentation":"A catch-all for spawn failures of the omx-api binary that are neither 'missing' (ENOENT) nor 'blocked' (EACCES/EPERM). The raw errno.message from Node's spawn error is surfaced, e.g. EMFILE, ENOMEM, E2BIG, or unsupported-platform errors.","triggerScenarios":"Calling `omx api` when the process cannot spawn due to resource exhaustion (EMFILE from fd limits, ENOMEM), an overlong argv (E2BIG), or platform-level spawn restrictions not classified elsewhere.","commonSituations":"Low ulimits in CI (`ulimit -n`), out-of-memory containers, extremely long CLI arguments, exotic sandboxed runtimes.","solutions":["Read the appended errno message and address that specific OS error (raise ulimit, add memory, shorten args)","Raise file-descriptor limits: `ulimit -n 4096` before running omx","If sandboxing is the cause, run outside the sandbox or grant spawn permissions","Report the errno code to omx maintainers if it should be classified as missing/blocked"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { ulimitCheck } from 'node:os'; // pseudo\n// Raise fd limit / verify memory before spawning the binary\nprocess.on('beforeExit', () => {});","typeGuard":null,"tryCatchPattern":"catch (e) { const m = /failed to launch native binary: (.+)/.exec(String(e)); if (m) handleErrnoMessage(m[1]); else throw e; }","preventionTips":["Raise ulimit -n in CI shells","Keep argument lists short","Surface raw errno text to ops for triage"],"tags":["spawn","errno","system-resources","api"],"backgroundTag":"spawn-failure","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}