{"record":{"id":"069644d470b5326d","repo":"diegosouzapw/OmniRoute","slug":"certificate-file-not-found-certpath","errorCode":null,"errorMessage":"Certificate file not found: ${certPath}","messagePattern":"Certificate file not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mitm/cert/install.ts","lineNumber":194,"sourceCode":"export function certutilThumbprint(certPath: string): string {\n  return getCertFingerprint(certPath).replace(/:/g, \"\");\n}\n\nasync function checkCertInstalledWindows(certPath: string): Promise<boolean> {\n  try {\n    await execFileText(\"certutil\", [\"-store\", \"Root\", certutilThumbprint(certPath)]);\n    return true;\n  } catch {\n    return false;\n  }\n}\n\n/**\n * Install SSL certificate to system trust store\n */\nexport async function installCert(sudoPassword: string, certPath: string): Promise<void> {\n  if (!fs.existsSync(certPath)) {\n    throw new Error(`Certificate file not found: ${certPath}`);\n  }\n\n  const isInstalled = await checkCertInstalled(certPath);\n  if (isInstalled) {\n    // #9442: the fingerprint matched, but a restrictive umask at install time\n    // may have left the system cert as 0600 — unreadable by non-root TLS\n    // clients (curl, reqwest, uv, Python requests). Repair the mode before\n    // the early return so re-running install fixes a previously wrong-mode\n    // cert instead of silently skipping it.\n    if (!IS_WIN && !IS_MAC) {\n      const config = getLinuxCertConfig();\n      await ensureSystemCertMode(`${config.dir}/${LINUX_CERT_NAME}`, sudoPassword);\n    }\n    console.log(\"✅ Certificate already installed\");\n    return;\n  }\n\n  if (process.env.OMNIROUTE_SKIP_SYSTEM_TRUST === \"1\") {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/mitm/cert/install.ts#L176-L212","documentation":"Precondition check in installCert: fs.existsSync(certPath) is false — the PEM file to install into the system trust store is not on disk. Means the MITM CA was never generated, was deleted, or the path configured for the operation points nowhere; nothing can be installed until the cert exists.","triggerScenarios":"Thrown at src/mitm/cert/install.ts:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Generate the MITM root CA first (start the MITM proxy so it creates the cert)","Check the cert path in the request/settings for typos","Restore the cert from backup if it was deleted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}