diegosouzapw/OmniRoute · error · Error

MITM proxy is already running

Error message

MITM proxy is already running

What it means

Error "MITM proxy is already running" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/mitm/manager.ts:447

    dnsConfigured,
    certExists,
    orphanedStateDetected: _orphanedStateDetected,
  };
}

/**
 * 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

View on GitHub (pinned to a179ffed5b)

When it happens

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