diegosouzapw/OmniRoute · error · Error

MITM server is already starting

Error message

MITM server is already starting

What it means

Error "MITM server is already starting" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/mitm/manager.ts:453

/**
 * Start MITM proxy
 * @param {string} apiKey - OmniRoute API key
 * @param {string} sudoPassword - Sudo password for DNS/cert operations
 */
export async function startMitm(
  apiKey: string,
  sudoPassword: string,
  options: { port?: number } = {}
): Promise<{ running: true; pid: number | null; certTrusted: boolean }> {
  // Check if already running
  if (serverProcess && !serverProcess.killed) {
    throw new Error("MITM proxy is already running");
  }

  // Check if another startMitm() call is already in flight (TOCTOU guard —
  // see the `mitmStarting` comment above).
  if (!tryAcquireMitmStartLock()) {
    throw new Error("MITM server is already starting");
  }

  try {
    return await startMitmInternal(apiKey, sudoPassword, options);
  } finally {
    releaseMitmStartLock();
  }
}

/**
 * Internal body of startMitm(), extracted so the single-flight lock in
 * startMitm() cleanly wraps it in try/finally without re-indenting the
 * entire implementation.
 */
async function startMitmInternal(
  apiKey: string,
  sudoPassword: string,
  options: { port?: number }

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/mitm/manager.ts:453 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/30a6d2e6814c0d26. Report an issue: GitHub.