OpenBB-finance/OpenBB · error · FileNotFoundError
Certificate file '{cert}' not found
Error message
Certificate file '{cert}' not found What it means
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.
Source
Thrown at openbb_platform/core/openbb_core/provider/utils/helpers.py:474
raise exceptions[0] # type: ignore
return results
finally:
await session.close()
def combine_certificates(cert: str, bundle: str | None = None) -> str:
"""Combine a certificate and a bundle into a single certificate file. Use the default bundle if none is provided."""
# pylint: disable=import-outside-toplevel
import atexit # noqa
import certifi
import shutil
from pathlib import Path
from warnings import warn
if not Path(cert).exists():
raise FileNotFoundError(f"Certificate file '{cert}' not found")
if cert.split(".")[0].endswith("_combined"):
return cert
combined_cert = cert.split(".")[0] + "_combined." + cert.split(".")[1]
if Path(combined_cert).exists():
return combined_cert
if not bundle:
bundle = certifi.where()
try:
with open(combined_cert, "wb") as combined_cert_file:
# Write the default CA bundle to the combined certificate file
with open(bundle, "rb") as bundle_file:
shutil.copyfileobj(bundle_file, combined_cert_file)
View on GitHub (pinned to 3e071fcc2c)
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
Example fix
# before
obb.user.credentials.premium_credentials = ...
obb.user.preferences.ssl_cert = "certs/myca.pem" # file actually named myca.crt -> FileNotFoundError
# after
from pathlib import Path
p = Path("/etc/openbb/certs/myca.crt").resolve()
assert p.exists(), f"missing cert: {p}"
obb.user.preferences.ssl_cert = str(p) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def safe_cert_path(cert: str) -> str:
p = Path(cert).expanduser().resolve()
if not p.is_file():
raise FileNotFoundError(f"configure a valid cert; not found: {p}")
return str(p) Try / catch
from openbb_core.provider.utils.helpers import combine_certificates
try:
combined = combine_certificates(cert_path)
except FileNotFoundError:
cert_path = safe_cert_path(DEFAULT_CERT) # re-resolve or fall back to system bundle
combined = combine_certificates(cert_path) Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
Related errors
- Provider fallback failed. [Providers] {msg}
- Failed to cast {value} to bool.
- Missing credential '{c}'.{extra_msg} Refer to the documentat
- Target provider '{target}' has no configured root directorie
- Missing credentials: congress_gov_api_key
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/9ff2018fd75412c0.
Report an issue: GitHub.