{"record":{"id":"16cf43eec1b87301","repo":"BerriAI/litellm","slug":"failed-to-read-private-key-file-file-path-e","errorCode":null,"errorMessage":"Failed to read private key file '{file_path}': {e}","messagePattern":"Failed to read private key file '(.+?)': (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"litellm/llms/oci/common_utils.py","lineNumber":135,"sourceCode":"    _require_cryptography()\n    key: Final = serialization.load_pem_private_key(\n        key_str.encode(\"utf-8\"),\n        password=None,\n    )\n    if not isinstance(key, rsa.RSAPrivateKey):\n        raise TypeError(\"The provided private key is not an RSA key, which is required for OCI signing.\")\n    return key\n\n\ndef load_private_key_from_file(file_path: str) -> Any:\n    \"\"\"Loads a private key from a file path.\"\"\"\n    try:\n        with open(file_path, \"r\", encoding=\"utf-8\") as f:\n            key_str: Final = f.read().strip()\n    except FileNotFoundError:\n        raise FileNotFoundError(f\"Private key file not found: {file_path}\")\n    except OSError as e:\n        raise OSError(f\"Failed to read private key file '{file_path}': {e}\") from e\n\n    if not key_str:\n        raise ValueError(f\"Private key file is empty: {file_path}\")\n\n    return load_private_key_from_str(key_str)\n\n\n# ---------------------------------------------------------------------------\n# Env-var credential resolution\n# ---------------------------------------------------------------------------\n\n_OCI_REGION_ENV: Final = \"OCI_REGION\"\n_OCI_USER_ENV: Final = \"OCI_USER\"\n_OCI_FINGERPRINT_ENV: Final = \"OCI_FINGERPRINT\"\n_OCI_TENANCY_ENV: Final = \"OCI_TENANCY\"\n_OCI_KEY_FILE_ENV: Final = \"OCI_KEY_FILE\"\n_OCI_KEY_ENV: Final = \"OCI_KEY\"\n_OCI_COMPARTMENT_ID_ENV: Final = \"OCI_COMPARTMENT_ID\"","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/oci/common_utils.py#L117-L153","documentation":"Error \"Failed to read private key file '{file_path}': {e}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/oci/common_utils.py:135 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix filesystem permissions on the key file shown in the message and ensure it is readable; see the wrapped error {e}."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}