BerriAI/litellm · error · FileNotFoundError
Private key file not found
Error message
Private key file not found: {file_path} What it means
Error "Private key file not found: {file_path}" thrown in BerriAI/litellm.
Solutions
- Correct the oci_key_file path shown in the message so it points to an existing PEM private key file.
When it happens
Trigger: Thrown at litellm/llms/oci/common_utils.py:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/2117ffe27e57fd35.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/oci/common_utils.py:133
def load_private_key_from_str(key_str: str) -> Any:
_require_cryptography()
key: Final = serialization.load_pem_private_key(
key_str.encode("utf-8"),
password=None,
)
if not isinstance(key, rsa.RSAPrivateKey):
raise TypeError("The provided private key is not an RSA key, which is required for OCI signing.")
return key
def load_private_key_from_file(file_path: str) -> Any:
"""Loads a private key from a file path."""
try:
with open(file_path, "r", encoding="utf-8") as f:
key_str: Final = f.read().strip()
except FileNotFoundError:
raise FileNotFoundError(f"Private key file not found: {file_path}")
except OSError as e:
raise OSError(f"Failed to read private key file '{file_path}': {e}") from e
if not key_str:
raise ValueError(f"Private key file is empty: {file_path}")
return load_private_key_from_str(key_str)
# ---------------------------------------------------------------------------
# Env-var credential resolution
# ---------------------------------------------------------------------------
_OCI_REGION_ENV: Final = "OCI_REGION"
_OCI_USER_ENV: Final = "OCI_USER"
_OCI_FINGERPRINT_ENV: Final = "OCI_FINGERPRINT"
_OCI_TENANCY_ENV: Final = "OCI_TENANCY"
_OCI_KEY_FILE_ENV: Final = "OCI_KEY_FILE"View on GitHub (pinned to 77b7c6c40c)