{"record":{"id":"e65dc4278f9a9781","repo":"usebruno/bruno","slug":"certfilepath-is-required-for-cert-type","errorCode":null,"errorMessage":"certFilePath is required for cert type","messagePattern":"certFilePath is required for cert type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-requests/src/utils/http-https-agents.ts","lineNumber":284,"sourceCode":"  }\n\n  // client certificate config\n  const clientCertConfig = get(clientCertificates, 'certs', []) as ClientCertificate[];\n\n  for (const clientCert of clientCertConfig) {\n    if (clientCert?.disabled) {\n      continue;\n    }\n    const domain = clientCert?.domain;\n    const type = clientCert?.type || 'cert';\n    if (domain) {\n      const hostRegex = '^(https:\\\\/\\\\/|grpc:\\\\/\\\\/|grpcs:\\\\/\\\\/)?' + domain.replace(/\\./g, '\\\\.').replace(/\\*/g, '.*');\n      if (requestUrl && requestUrl.match(hostRegex)) {\n        if (type === 'cert') {\n          try {\n            let certFilePath = clientCert?.certFilePath;\n            if (!certFilePath) {\n              throw new Error('certFilePath is required for cert type');\n            }\n            certFilePath = path.isAbsolute(certFilePath) ? certFilePath : path.join(collectionPath, certFilePath);\n            let keyFilePath = clientCert?.keyFilePath;\n            if (!keyFilePath) {\n              throw new Error('keyFilePath is required for cert type');\n            }\n            keyFilePath = path.isAbsolute(keyFilePath) ? keyFilePath : path.join(collectionPath, keyFilePath);\n\n            certsConfig.cert = fs.readFileSync(certFilePath);\n            certsConfig.key = fs.readFileSync(keyFilePath);\n          } catch (err: any) {\n            console.error('Error reading cert/key file', err);\n            throw new Error(`Error reading cert/key file: ${err.message}`);\n          }\n        } else if (type === 'pfx') {\n          try {\n            let pfxFilePath = clientCert?.pfxFilePath;\n            if (!pfxFilePath) {","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-requests/src/utils/http-https-agents.ts#L266-L302","documentation":"When a client certificate entry has type 'cert' (the default), the loader requires clientCert.certFilePath to be set. A falsy value throws before any path resolution or file read.","triggerScenarios":"A clientCertificates entry matches the request URL's domain and is enabled, but its certFilePath field is empty/undefined while type is 'cert'.","commonSituations":"User created a client-cert row, filled the domain, but forgot to pick the cert file; JSON config hand-edited and the certFilePath key dropped; migration from an older schema that did not store certFilePath.","solutions":["Open the collection's Client Certificates settings and select a cert file for the matching domain entry.","Ensure the persisted clientCert object includes certFilePath (and keyFilePath) before issuing the request.","If the cert is genuinely absent, disable the entry (clientCert.disabled = true) so it is skipped."],"exampleFix":"// before\n{ domain:'api.example.com', type:'cert', keyFilePath:'/k.pem' } // no certFilePath\n\n// after\n{ domain:'api.example.com', type:'cert', certFilePath:'/c.pem', keyFilePath:'/k.pem' }","handlingStrategy":"validation","validationCode":"for (const cc of clientCertificates?.certs ?? []) {\n  if (!cc.disabled && cc.type !== 'pfx' && !cc.certFilePath) throw new Error(`certFilePath missing for domain ${cc.domain}`);\n}","typeGuard":"function isValidCertEntry(c): boolean { return c?.type === 'pfx' ? !!c.pfxFilePath : !!c?.certFilePath && !!c?.keyFilePath; }","tryCatchPattern":null,"preventionTips":["Validate cert entries before issuing requests.","Disable incomplete entries rather than leaving them partial."],"tags":["tls","client-cert","validation","config"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}