BerriAI/litellm · error · ValueError
Unable to get vertex url/endpoint for mode: {mode}
Error message
Unable to get vertex url/endpoint for mode: {mode} What it means
Vertex URL mapper sentinel: get_url for the given mode (e.g. an unsupported operation type) has no URL-building branch, so it raises to signal the mode/path combination is unhandled rather than returning a bogus endpoint.
Source
Thrown at litellm/llms/vertex_ai/common_utils.py:446
vertex_project=vertex_project,
vertex_location=vertex_location,
vertex_api_version=vertex_api_version,
)
elif mode == "image_generation":
endpoint = "predict"
base_url = get_vertex_base_url(vertex_location)
if model.isdigit():
# Numeric model -> custom endpoint
url = f"{base_url}/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}"
else:
# Regular model -> publisher model
url = f"{base_url}/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}"
elif mode == "count_tokens":
endpoint = "countTokens"
base_url = get_vertex_base_url(vertex_location)
url = f"{base_url}/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}"
if not url or not endpoint:
raise ValueError(f"Unable to get vertex url/endpoint for mode: {mode}")
return url, endpoint
def _get_gemini_url(
mode: all_gemini_url_modes,
model: str,
stream: bool | None,
) -> tuple[str, str]:
"""Build the Gemini API URL for the given mode.
The API key is NOT included in the URL. Callers must pass it via the
``x-goog-api-key`` header instead to avoid leaking credentials in
error tracebacks.
"""
from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import (
VertexGeminiConfig,
)
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use a supported mode for Vertex AI (chat, embedding, image_generation, etc.).
- Check the call type and provider route configuration.
Example fix
# verify the litellm call function matches a supported vertex mode.
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when no Vertex AI URL/endpoint can be constructed for the requested mode.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/cc781e0059db9954.
Report an issue: GitHub.