{"record":{"id":"f070b0e65e1872c7","repo":"diegosouzapw/OmniRoute","slug":"agentbridge-upstream-ca-cert-path-does-not-exist","errorCode":null,"errorMessage":"AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath}","messagePattern":"AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/mitm/upstreamTrust.ts","lineNumber":31,"sourceCode":" * Configure undici's global dispatcher to trust a custom CA certificate.\n *\n * `undici` is loaded lazily (only when a CA is actually being configured) so\n * that merely importing this module — which happens transitively from every\n * MITM handler via `base.ts` — does not eagerly pull in undici's full index.\n * That keeps the module importable in test/toolchain environments where the\n * installed undici may be incompatible with the running Node version, and\n * avoids loading a heavy dependency for the common no-CA path.\n *\n * @param pemPath - Absolute path to the PEM file. If undefined/empty, no-op.\n * @throws {Error} With a safe error message (no stack trace) if pemPath is set\n *   but the file does not exist.\n */\nexport function configureUpstreamCa(pemPath?: string): void {\n  if (!pemPath) return;\n\n  if (!existsSync(pemPath)) {\n    // Safe error: message only contains the user-supplied path (no stack trace).\n    throw new Error(\n      `AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath}`,\n    );\n  }\n\n  const ca = readFileSync(pemPath, \"utf8\");\n  const require = createRequire(import.meta.url);\n  const { Agent, setGlobalDispatcher } = require(\"undici\") as typeof import(\"undici\");\n  setGlobalDispatcher(new Agent({ connect: { ca } }));\n}\n","sourceCodeStart":13,"sourceCodeEnd":41,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/mitm/upstreamTrust.ts#L13-L41","documentation":"Error \"AGENTBRIDGE_UPSTREAM_CA_CERT path does not exist: ${pemPath}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/mitm/upstreamTrust.ts:31 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"}