BerriAI/litellm · error · ValueError
Missing required environment variable - GOOGLE_KMS_RESOURCE_
Error message
Missing required environment variable - GOOGLE_KMS_RESOURCE_NAME
What it means
Second environment check in Google KMS validate_environment: GOOGLE_APPLICATION_CREDENTIALS passed, but GOOGLE_KMS_RESOURCE_NAME (the key ring resource path used for decrypt calls) is missing from the environment.
Source
Thrown at litellm/secret_managers/google_kms.py:22
Relevant issue: https://github.com/BerriAI/litellm/issues/1235
Requires:
* `os.environ["GOOGLE_APPLICATION_CREDENTIALS"], os.environ["GOOGLE_KMS_RESOURCE_NAME"]`
* `pip install google-cloud-kms`
"""
import os
from typing import Final
import litellm
from litellm.proxy._types import KeyManagementSystem
def validate_environment():
if "GOOGLE_APPLICATION_CREDENTIALS" not in os.environ:
raise ValueError("Missing required environment variable - GOOGLE_APPLICATION_CREDENTIALS")
if "GOOGLE_KMS_RESOURCE_NAME" not in os.environ:
raise ValueError("Missing required environment variable - GOOGLE_KMS_RESOURCE_NAME")
def load_google_kms(use_google_kms: bool | None):
if use_google_kms is None or use_google_kms is False:
return
try:
from google.cloud import kms_v1
validate_environment()
# Create the KMS client
client: Final = kms_v1.KeyManagementServiceClient()
litellm.secret_manager_client = client
litellm._key_management_system = KeyManagementSystem.GOOGLE_KMS
litellm._google_kms_resource_name = os.getenv("GOOGLE_KMS_RESOURCE_NAME")
except Exception as e:
raise e
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set GOOGLE_KMS_RESOURCE_NAME to the full KMS key resource name (projects/.../locations/.../keyRings/.../cryptoKeys/...).
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/secret_managers/google_kms.py:22 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/01e20c9fdfd4321c.
Report an issue: GitHub.