diegosouzapw/OmniRoute · error · Error

system proxy apply failed

Error message

system proxy apply failed

What it means

Sanitized catch-all from apply(): the platform-specific system-proxy mutation (macosApply/linux/windows) threw, and the raw error was collapsed via sanitizeErrorMessage — or, when sanitization produced nothing, this literal fallback text. Means the OS-level proxy setting did NOT change (prior state is not reliable); the true cause (command failure, permissions) is intentionally not leaked per Hard Rule #12.

Solutions

  1. Re-run apply() and watch system logs to identify the failing OS command
  2. Verify sudo/admin privileges for changing system proxy settings
  3. Prefer revert() with the captured previousState only if the platform reported partial success
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/mitm/inspector/systemProxyConfig.ts:275 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/ed0f423b751a5565. Report an issue: GitHub.

Appendix: source

Thrown at src/mitm/inspector/systemProxyConfig.ts:275

// ────────────────────────────────────────────────────────────────────────────

/**
 * Apply OmniRoute as the system-wide HTTP/HTTPS proxy at `127.0.0.1:<port>`.
 * Captures and returns the prior configuration so callers can revert later.
 *
 * Throws a sanitized `Error` if the underlying command fails (no stack/path
 * leakage — see Hard Rule #12).
 */
export async function apply(port: number): Promise<ApplyResult> {
  const platform = detectPlatform();
  try {
    let previousState: PreviousState;
    if (platform === "macos") previousState = await macosApply(port);
    else if (platform === "windows") previousState = await windowsApply(port);
    else previousState = await linuxApply(port);
    return { platform, previousState };
  } catch (err) {
    throw new Error(sanitizeErrorMessage(err) || "system proxy apply failed");
  }
}

/**
 * Restore the prior configuration captured by `apply()`. No-op if the
 * `previousState` payload does not match a known platform.
 */
export async function revert(previousState: PreviousState | unknown): Promise<void> {
  if (!previousState || typeof previousState !== "object") return;
  const state = previousState as Record<string, unknown>;
  const platform = state.platform;
  try {
    if (platform === "macos") await macosRevert(state as unknown as MacOsPreviousState);
    else if (platform === "linux") await linuxRevert(state as unknown as LinuxPreviousState);
    else if (platform === "windows") await windowsRevert(state as unknown as WindowsPreviousState);
  } catch (err) {
    throw new Error(sanitizeErrorMessage(err) || "system proxy revert failed");
  }

View on GitHub (pinned to a179ffed5b)