{"record":{"id":"43ade9b7cdbed718","repo":"diegosouzapw/OmniRoute","slug":"spawn-failed","errorCode":"SPAWN_FAILED","errorMessage":"Failed to spawn headroom proxy","messagePattern":"Failed to spawn headroom proxy","errorType":"exception","errorClass":"HeadroomError","httpStatus":null,"severity":"error","filePath":"src/lib/headroom/process.ts","lineNumber":115,"sourceCode":"\n  const existing = getManagedPid();\n  if (existing) return { pid: existing, alreadyRunning: true };\n\n  ensureDir();\n  const outFd = fs.openSync(LOG_FILE, \"a\");\n\n  // spawn (no shell) with array args — argv is passed directly to the\n  // headroom binary, so no shell-metacharacter handling is needed.\n  const child = spawn(binary, [\"proxy\", \"--port\", String(safePort(opts.port))], {\n    stdio: [\"ignore\", outFd, outFd],\n    detached: true,\n    windowsHide: true,\n    env: { ...process.env },\n  });\n\n  if (!child.pid) {\n    fs.closeSync(outFd);\n    throw new HeadroomError(\"Failed to spawn headroom proxy\", \"SPAWN_FAILED\");\n  }\n\n  child.unref();\n  writePid(child.pid);\n\n  await new Promise<void>((resolve, reject) => {\n    const timer = setTimeout(() => {\n      if (isPidAlive(child.pid!)) resolve();\n      else\n        reject(\n          new HeadroomError(\"headroom proxy exited during startup — see proxy.log\", \"EARLY_EXIT\")\n        );\n    }, STARTUP_TIMEOUT_MS);\n\n    child.once(\"exit\", (code) => {\n      clearTimeout(timer);\n      clearPid();\n      try {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/headroom/process.ts#L97-L133","documentation":"Error \"Failed to spawn headroom proxy\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/headroom/process.ts:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}