BerriAI/litellm · error · ValueError
GOOGLE_PSE_ENGINE_ID is required
Error message
GOOGLE_PSE_ENGINE_ID is required
What it means
Error "GOOGLE_PSE_ENGINE_ID is required" thrown in BerriAI/litellm.
Solutions
- Set GOOGLE_PSE_ENGINE_ID, or pass search_engine_id in the call.
When it happens
Trigger: Thrown at litellm/llms/google_pse/search/transformation.py:178 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/ba5dfa9e38f11f44.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/google_pse/search/transformation.py:178
# Google PSE only supports single string queries
query = " ".join(query)
# Get API credentials. The key is sent as a query param to api_base, so
# resolve it host-aware to avoid leaking a server-managed key to a
# caller-supplied host.
api_key = self.resolve_server_api_key(
caller_api_key=api_key,
caller_api_base=api_base,
key_env_vars=("GOOGLE_PSE_API_KEY",),
base_env_var="GOOGLE_PSE_API_BASE",
default_api_base=self.GOOGLE_PSE_API_BASE,
)
search_engine_id = search_engine_id or get_secret_str("GOOGLE_PSE_ENGINE_ID")
if not api_key:
raise ValueError("GOOGLE_PSE_API_KEY is required")
if not search_engine_id:
raise ValueError("GOOGLE_PSE_ENGINE_ID is required")
request_data: Final[GooglePSESearchRequest] = {
"q": query,
"cx": search_engine_id,
"key": api_key,
}
# Transform unified spec parameters to Google PSE format
if "max_results" in optional_params:
# Google PSE supports 1-10 results per request
num_results: Final = min(optional_params["max_results"], 10)
request_data["num"] = num_results
if "search_domain_filter" in optional_params:
# Convert list to single domain (take first if multiple)
domains: Final = optional_params["search_domain_filter"]
if isinstance(domains, list) and len(domains) > 0:
request_data["siteSearch"] = domains[0]View on GitHub (pinned to 77b7c6c40c)