diegosouzapw/OmniRoute · error · Error

ChatGPT Web (Codex) supervisor lease could not be acquired

Error message

ChatGPT Web (Codex) supervisor lease could not be acquired

What it means

Lease acquisition failure in acquireTunnelSupervisorLease: after the EEXIST path — including attempting to remove a stale lease whose owner PID is dead — the exclusive lease could not be secured before the final throw. A concurrent process won the race for the recreated lease file.

Solutions

  1. Retry starting the tunnel runtime — the competing process likely acquired the lease and will serve it
  2. Ensure only one process attempts to start the tunnel supervisor at a time
  3. Remove a corrupt lease file manually while no OmniRoute process is running, then retry
Defensive patterns

Strategy: retry

When it happens

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

Appendix: source

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

      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 {
      ownedByCurrentProcess: ownerPid === process.pid,
      conflict: Boolean(ownerPid && ownerPid !== process.pid && processIsAlive(ownerPid)),
      ...(ownerPid ? { ownerPid } : {}),
    };
  } catch {

View on GitHub (pinned to a179ffed5b)