{"record":{"id":"122b717af7e810dc","repo":"BerriAI/litellm","slug":"private-key-is-required-for-oci-authentication-pr","errorCode":null,"errorMessage":"Private key is required for OCI authentication. Provide either oci_key or oci_key_file.","messagePattern":"Private key is required for OCI authentication\\. Provide either oci_key or oci_key_file\\.","errorType":"exception","errorClass":"OCIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/oci/common_utils.py","lineNumber":325,"sourceCode":"            raise OCIError(\n                status_code=400,\n                message=(\n                    f\"oci_key must be a string containing the PEM private key content. \"\n                    f\"Got type: {type(oci_key).__name__}\"\n                ),\n            )\n        oci_key_content = oci_key.replace(\"\\\\n\", \"\\n\").replace(\"\\r\\n\", \"\\n\")\n\n    private_key: Final = (\n        load_private_key_from_str(oci_key_content)\n        if oci_key_content\n        else load_private_key_from_file(oci_key_file)\n        if oci_key_file\n        else None\n    )\n\n    if private_key is None:\n        raise OCIError(\n            status_code=400,\n            message=\"Private key is required for OCI authentication. Provide either oci_key or oci_key_file.\",\n        )\n\n    signature: Final = private_key.sign(\n        signing_string.encode(\"utf-8\"),\n        padding.PKCS1v15(),\n        hashes.SHA256(),\n    )\n    signature_b64: Final = base64.b64encode(signature).decode()\n\n    key_id: Final = f\"{oci_tenancy}/{oci_user}/{oci_fingerprint}\"\n    authorization: Final = (\n        'Signature version=\"1\",'\n        f'keyId=\"{key_id}\",'\n        'algorithm=\"rsa-sha256\",'\n        f'headers=\"{\" \".join(signed_header_names)}\",'\n        f'signature=\"{signature_b64}\"'","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/oci/common_utils.py#L307-L343","documentation":"Error \"Private key is required for OCI authentication. Provide either oci_key or oci_key_file.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/oci/common_utils.py:325 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide either oci_key (PEM string) or oci_key_file (path to PEM file) for OCI authentication."],"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"}