BerriAI/litellm · error · ValueError
vector_store_id is required when vertex_engine_id is not set
Error message
vector_store_id is required when vertex_engine_id is not set
What it means
Raised while building the Vertex AI Search (discoveryengine) URL: neither vertex_engine_id nor vector_store_id was supplied, so there is no data-store/engine path segment to encode. The request builder cannot construct a valid endpoint without one of them.
Source
Thrown at litellm/llms/vertex_ai/vector_stores/search_api/transformation.py:187
vertex_location: Final = self.get_vertex_ai_location(litellm_params)
vertex_project: Final = self.get_vertex_ai_project(litellm_params)
collection_id: Final = litellm_params.get("vertex_collection_id") or "default_collection"
encoded_collection_id: Final = encode_url_path_segment(collection_id, field_name="vertex_collection_id")
base: Final = (
f"https://discoveryengine.googleapis.com/v1/"
f"projects/{vertex_project}/locations/{vertex_location}/"
f"collections/{encoded_collection_id}"
)
engine_id: Final = litellm_params.get("vertex_engine_id")
if engine_id:
encoded_engine_id: Final = encode_url_path_segment(engine_id, field_name="vertex_engine_id")
return f"{base}/engines/{encoded_engine_id}/servingConfigs/default_serving_config"
datastore_id: Final = litellm_params.get("vector_store_id")
if not datastore_id:
raise ValueError("vector_store_id is required when vertex_engine_id is not set")
encoded_datastore_id: Final = encode_url_path_segment(datastore_id, field_name="vector_store_id")
return f"{base}/dataStores/{encoded_datastore_id}/servingConfigs/default_config"
def transform_search_vector_store_request(
self,
vector_store_id: str,
query: str | list[str],
vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,
api_base: str,
litellm_logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
extra_body: dict[str, Any] | None = None,
) -> tuple[str, dict[str, Any]]:
"""
Transform a search request for the Vertex AI Search (Discovery Engine) API.
Per-request params pass through to the engine: max_num_results maps to
pageSize, and extra_body fields on the supported allowlistView on GitHub (pinned to 77b7c6c40c)
Solutions
- Pass vector_store_id (the Vertex AI Search data store ID) in the request or configuration.
- Alternatively set vertex_engine_id if you intend to search an engine instead of a single data store.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/vector_stores/search_api/transformation.py:187 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/eef4ff5ca938c735.
Report an issue: GitHub.