{"record":{"id":"ed0f423b751a5565","repo":"diegosouzapw/OmniRoute","slug":"system-proxy-apply-failed","errorCode":null,"errorMessage":"system proxy apply failed","messagePattern":"system proxy apply failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mitm/inspector/systemProxyConfig.ts","lineNumber":275,"sourceCode":"// ────────────────────────────────────────────────────────────────────────────\n\n/**\n * Apply OmniRoute as the system-wide HTTP/HTTPS proxy at `127.0.0.1:<port>`.\n * Captures and returns the prior configuration so callers can revert later.\n *\n * Throws a sanitized `Error` if the underlying command fails (no stack/path\n * leakage — see Hard Rule #12).\n */\nexport async function apply(port: number): Promise<ApplyResult> {\n  const platform = detectPlatform();\n  try {\n    let previousState: PreviousState;\n    if (platform === \"macos\") previousState = await macosApply(port);\n    else if (platform === \"windows\") previousState = await windowsApply(port);\n    else previousState = await linuxApply(port);\n    return { platform, previousState };\n  } catch (err) {\n    throw new Error(sanitizeErrorMessage(err) || \"system proxy apply failed\");\n  }\n}\n\n/**\n * Restore the prior configuration captured by `apply()`. No-op if the\n * `previousState` payload does not match a known platform.\n */\nexport async function revert(previousState: PreviousState | unknown): Promise<void> {\n  if (!previousState || typeof previousState !== \"object\") return;\n  const state = previousState as Record<string, unknown>;\n  const platform = state.platform;\n  try {\n    if (platform === \"macos\") await macosRevert(state as unknown as MacOsPreviousState);\n    else if (platform === \"linux\") await linuxRevert(state as unknown as LinuxPreviousState);\n    else if (platform === \"windows\") await windowsRevert(state as unknown as WindowsPreviousState);\n  } catch (err) {\n    throw new Error(sanitizeErrorMessage(err) || \"system proxy revert failed\");\n  }","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/mitm/inspector/systemProxyConfig.ts#L257-L293","documentation":"Error \"system proxy apply failed\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/mitm/inspector/systemProxyConfig.ts:275 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}