BerriAI/litellm · error · ValueError
GOOGLE_PSE_ENGINE_ID is not set. Set `GOOGLE_PSE_ENGINE_ID`…
Error message
GOOGLE_PSE_ENGINE_ID is not set. Set `GOOGLE_PSE_ENGINE_ID` environment variable or pass `search_engine_id` parameter.
What it means
Error "GOOGLE_PSE_ENGINE_ID is not set. Set `GOOGLE_PSE_ENGINE_ID` environment variable or pass `search_engine_id` parameter." 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:97 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/d3f491dc35c638f1.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/google_pse/search/transformation.py:97
Validate environment and return headers.
Google PSE uses API key as a query parameter, not in headers.
This method is called but headers are not used for authentication.
"""
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,
)
if not api_key:
raise ValueError("GOOGLE_PSE_API_KEY is not set. Set `GOOGLE_PSE_API_KEY` environment variable.")
# Also check for search engine ID
search_engine_id: Final = kwargs.get("search_engine_id") or get_secret_str("GOOGLE_PSE_ENGINE_ID")
if not search_engine_id:
raise ValueError(
"GOOGLE_PSE_ENGINE_ID is not set. Set `GOOGLE_PSE_ENGINE_ID` environment variable or pass `search_engine_id` parameter."
)
headers["Content-Type"] = "application/json"
return headers
def get_complete_url(
self,
api_base: str | None,
optional_params: dict,
data: dict | list[dict] | None = None,
**kwargs,
) -> str:
"""
Get complete URL for Search endpoint with query parameters.
Google PSE uses GET requests, so we build the full URL with query params here.
The transformed request body (data) contains the parameters needed for the URL.View on GitHub (pinned to 77b7c6c40c)