diegosouzapw/OmniRoute · error · Error

ChatGPT Web (Codex) supervisor is already owned by process

Error message

ChatGPT Web (Codex) supervisor is already owned by process ${ownerPid}

What it means

Single-instance guard in acquireTunnelSupervisorLease: the lease file already exists (O_EXCL/EEXIST) and the recorded owner PID is alive and is not this process. Another OmniRoute process already supervises the tunnel-client runtime, so this process must not start a second one; the input at fault is the existing supervisor lease file naming its owner.

Solutions

  1. Let the existing owner process serve the tunnel; run only one OmniRoute supervisor per host
  2. Shut down the other OmniRoute instance (by PID from the message) and retry
  3. If the owner is a stale-but-alive unrelated PID reuse, remove the lease file after confirming no tunnel is running
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at open-sse/executors/chatgpt-web-codex/tunnelClient.ts:166 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/006d3398826b0c09. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/chatgpt-web-codex/tunnelClient.ts:166

        closeSync(fd);
      }
      ownsSupervisorLease = true;
      return;
    } catch (error) {
      if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
      let ownerPid = 0;
      try {
        const lease = JSON.parse(readFileSync(path, "utf8")) as Partial<SupervisorLease>;
        ownerPid = Number(lease.pid) || 0;
      } catch {
        ownerPid = 0;
      }
      if (ownerPid === process.pid) {
        ownsSupervisorLease = true;
        return;
      }
      if (processIsAlive(ownerPid)) {
        throw new Error(`ChatGPT Web (Codex) supervisor is already owned by process ${ownerPid}`);
      }
      rmSync(path, { force: true });
    }
  }
  throw new Error("ChatGPT Web (Codex) supervisor lease could not be acquired");
}

export function tunnelSupervisorLeaseStatus(): {
  ownedByCurrentProcess: boolean;
  conflict: boolean;
  ownerPid?: number;
} {
  const path = tunnelClientPaths().supervisorLease;
  if (!existsSync(path)) return { ownedByCurrentProcess: false, conflict: false };
  try {
    const lease = JSON.parse(readFileSync(path, "utf8")) as Partial<SupervisorLease>;
    const ownerPid = Number(lease.pid) || undefined;
    return {

View on GitHub (pinned to a179ffed5b)