diegosouzapw/OmniRoute · error · HeadroomError

NOT_INSTALLED

NOT_INSTALLED

Error message

Headroom CLI not installed

What it means

startHeadroomProxy() could not locate the headroom binary on disk (findHeadroomBinary() returned null). Typed HeadroomError with code NOT_INSTALLED — the CLI must be installed before the proxy can be managed.

Solutions

  1. Install the headroom CLI and ensure it is on PATH
  2. Check the code === 'NOT_INSTALLED' discriminator and surface an install hint in the UI
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/lib/headroom/process.ts:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/1b5430a9db66cf3b. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/headroom/process.ts:95

  } catch {
    return false;
  }
}

export function getManagedPid(): number | null {
  const pid = readPid();
  return pid && isPidAlive(pid) ? pid : null;
}

function safePort(port: unknown): number {
  const n = Number(port);
  return Number.isFinite(n) && n > 0 && n < 65536 ? n : DEFAULT_PORT;
}

export async function startHeadroomProxy(opts: { port?: number } = {}): Promise<StartResult> {
  const binary = findHeadroomBinary();
  if (!binary) {
    throw new HeadroomError("Headroom CLI not installed", "NOT_INSTALLED");
  }

  const existing = getManagedPid();
  if (existing) return { pid: existing, alreadyRunning: true };

  ensureDir();
  const outFd = fs.openSync(LOG_FILE, "a");

  // spawn (no shell) with array args — argv is passed directly to the
  // headroom binary, so no shell-metacharacter handling is needed.
  const child = spawn(binary, ["proxy", "--port", String(safePort(opts.port))], {
    stdio: ["ignore", outFd, outFd],
    detached: true,
    windowsHide: true,
    env: { ...process.env },
  });

  if (!child.pid) {

View on GitHub (pinned to a179ffed5b)