{"record":{"id":"1b5430a9db66cf3b","repo":"diegosouzapw/OmniRoute","slug":"not-installed","errorCode":"NOT_INSTALLED","errorMessage":"Headroom CLI not installed","messagePattern":"Headroom CLI not installed","errorType":"exception","errorClass":"HeadroomError","httpStatus":null,"severity":"error","filePath":"src/lib/headroom/process.ts","lineNumber":95,"sourceCode":"  } catch {\n    return false;\n  }\n}\n\nexport function getManagedPid(): number | null {\n  const pid = readPid();\n  return pid && isPidAlive(pid) ? pid : null;\n}\n\nfunction safePort(port: unknown): number {\n  const n = Number(port);\n  return Number.isFinite(n) && n > 0 && n < 65536 ? n : DEFAULT_PORT;\n}\n\nexport async function startHeadroomProxy(opts: { port?: number } = {}): Promise<StartResult> {\n  const binary = findHeadroomBinary();\n  if (!binary) {\n    throw new HeadroomError(\"Headroom CLI not installed\", \"NOT_INSTALLED\");\n  }\n\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) {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/headroom/process.ts#L77-L113","documentation":"Error \"Headroom CLI not installed\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/headroom/process.ts:95 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"}