{"record":{"id":"9ff2018fd75412c0","repo":"OpenBB-finance/OpenBB","slug":"certificate-file-cert-not-found","errorCode":null,"errorMessage":"Certificate file '{cert}' not found","messagePattern":"Certificate file '(.+?)' not found","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"openbb_platform/core/openbb_core/provider/utils/helpers.py","lineNumber":474,"sourceCode":"            raise exceptions[0]  # type: ignore\n\n        return results\n\n    finally:\n        await session.close()\n\n\ndef combine_certificates(cert: str, bundle: str | None = None) -> str:\n    \"\"\"Combine a certificate and a bundle into a single certificate file. Use the default bundle if none is provided.\"\"\"\n    # pylint: disable=import-outside-toplevel\n    import atexit  # noqa\n    import certifi\n    import shutil\n    from pathlib import Path\n    from warnings import warn\n\n    if not Path(cert).exists():\n        raise FileNotFoundError(f\"Certificate file '{cert}' not found\")\n\n    if cert.split(\".\")[0].endswith(\"_combined\"):\n        return cert\n\n    combined_cert = cert.split(\".\")[0] + \"_combined.\" + cert.split(\".\")[1]\n\n    if Path(combined_cert).exists():\n        return combined_cert\n\n    if not bundle:\n        bundle = certifi.where()\n\n    try:\n        with open(combined_cert, \"wb\") as combined_cert_file:\n            # Write the default CA bundle to the combined certificate file\n            with open(bundle, \"rb\") as bundle_file:\n                shutil.copyfileobj(bundle_file, combined_cert_file)\n","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/core/openbb_core/provider/utils/helpers.py#L456-L492","documentation":"Raised by openbb_core.provider.utils.helpers.combine_certificates(cert, bundle=None), which merges a user-supplied PEM certificate with a CA bundle (certifi by default) into a '<name>_combined.<ext>' file. Before touching the network stack it checks Path(cert).exists() and raises FileNotFoundError if the caller-pointed certificate path does not exist on disk.","triggerScenarios":"Setting a custom SSL certificate in OpenBB preferences/user settings (e.g. behind a corporate MITM proxy) with a wrong path, a relative path resolved from a different working directory, or a path with typo'd filename/extension. Any provider fetch then fails while building the session.","commonSituations":"Corporate environments with SSL interception where the cert path was configured once and the file moved; containerized deployments where the cert was not copied into the image; Windows paths with backslashes mangled by shell escaping.","solutions":["Verify the path exists before configuring it: Path(cert).resolve() and check the spelling/extension","Use an absolute path in the preference so it does not depend on the process CWD","In Docker, confirm the cert file is actually COPY'd into the image and the config points at the container path","If the requirement disappeared, remove the certificate setting so the default certifi bundle is used"],"exampleFix":"# before\nobb.user.credentials.premium_credentials = ...\nobb.user.preferences.ssl_cert = \"certs/myca.pem\"  # file actually named myca.crt -> FileNotFoundError\n\n# after\nfrom pathlib import Path\np = Path(\"/etc/openbb/certs/myca.crt\").resolve()\nassert p.exists(), f\"missing cert: {p}\"\nobb.user.preferences.ssl_cert = str(p)","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef safe_cert_path(cert: str) -> str:\n    p = Path(cert).expanduser().resolve()\n    if not p.is_file():\n        raise FileNotFoundError(f\"configure a valid cert; not found: {p}\")\n    return str(p)","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.helpers import combine_certificates\n\ntry:\n    combined = combine_certificates(cert_path)\nexcept FileNotFoundError:\n    cert_path = safe_cert_path(DEFAULT_CERT)  # re-resolve or fall back to system bundle\n    combined = combine_certificates(cert_path)","preventionTips":["Store certificate paths as absolute, resolved paths in configuration","Add a startup health check in containers: assert Path(ssl_cert).is_file() before serving","Keep cert files and their config in the same deployment unit so they cannot drift"],"tags":["ssl","certificates","filesystem","configuration"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}