usebruno/bruno · error · Error

Invalid custom CA certificate path: ${caCertFilePath}

Error message

Invalid custom CA certificate path: ${caCertFilePath}

What it means

getCACertificates requires caCertFilePath to exist on disk; if fs.existsSync returns false it throws immediately, before any read attempt. Distinguishes a missing-path problem from a read problem.

Source

Thrown at packages/bruno-requests/src/utils/ca-cert.ts:122

    let customCerts: string[] = [];
    let nodeExtraCerts: string[] = [];

    // handle user-provided custom CA certificate file with optional default certificates
    if (caCertFilePath) {
      // validate custom CA certificate file
      if (fs.existsSync(caCertFilePath)) {
        try {
          const customCert = fs.readFileSync(caCertFilePath, 'utf8');
          if (customCert && customCert.trim()) {
            customCerts.push(customCert);
            caCertificatesCount.custom = customCerts.length;
          }
        } catch (err) {
          console.error(`Failed to read custom CA certificate from ${caCertFilePath}:`, (err as Error).message);
          throw new Error(`Unable to load custom CA certificate: ${(err as Error).message}`);
        }
      } else {
        throw new Error(`Invalid custom CA certificate path: ${caCertFilePath}`);
      }

      if (shouldKeepDefaultCerts) {
        // get system certs
        systemCerts = getSystemCerts();
        caCertificatesCount.system = systemCerts.length;

        // get root certs
        rootCerts = [...tls.rootCertificates];
        caCertificatesCount.root = rootCerts.length;
      }
    } else {
      // get system certs
      systemCerts = getSystemCerts();
      caCertificatesCount.system = systemCerts.length;

      // get root certs
      rootCerts = [...tls.rootCertificates];

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Verify the path exists: fs.existsSync(caCertFilePath) before passing it in.
  2. Use an absolute path and confirm it points to the actual cert file.
  3. If the path is relative, resolve it against the collection directory or app data dir explicitly.

Example fix

// before
{ caCertFilePath: './certs/ca.pem' } // resolved against wrong cwd -> not found

// after
{ caCertFilePath: path.join(collectionPath, 'certs', 'ca.pem') }
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
if (caCertFilePath && !fs.existsSync(caCertFilePath)) throw new Error(`Invalid custom CA certificate path: ${caCertFilePath}`);

Type guard

function isExistingPath(p): p is string { return typeof p === 'string' && !!p && fs.existsSync(p); }

Prevention

When it happens

Trigger: caCertFilePath is set to a path that does not exist on the filesystem (typo, relative path resolved against the wrong cwd, moved/deleted file, unmounted drive).

Common situations: User typed the path manually with a typo; path stored as relative but resolved against an unexpected working directory; collection moved machines and the absolute path no longer exists; environment variable for the cert path not set.

Understand the failure class

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/a2810c2e9b8fbaea. Report an issue: GitHub.