BerriAI/litellm · error · ValueError
Unsupported mode: {mode}
Error message
Unsupported mode: {mode} What it means
Gemini URL mapper sentinel: the requested mode has no corresponding generativelanguage.googleapis.com endpoint branch, so the mapper raises 'Unsupported mode' instead of fabricating a URL for an unknown operation.
Source
Thrown at litellm/llms/vertex_ai/common_utils.py:489
endpoint = "streamGenerateContent"
url = f"https://generativelanguage.googleapis.com/{api_version}/{_gemini_model_name}:{endpoint}?alt=sse"
else:
url = f"https://generativelanguage.googleapis.com/{api_version}/{_gemini_model_name}:{endpoint}"
elif mode == "embedding":
endpoint = "embedContent"
url = f"https://generativelanguage.googleapis.com/v1beta/{_gemini_model_name}:{endpoint}"
elif mode == "batch_embedding":
endpoint = "batchEmbedContents"
url = f"https://generativelanguage.googleapis.com/v1beta/{_gemini_model_name}:{endpoint}"
elif mode == "count_tokens":
endpoint = "countTokens"
url = f"https://generativelanguage.googleapis.com/v1beta/{_gemini_model_name}:{endpoint}"
elif mode == "image_generation":
raise ValueError(
"LiteLLM's `gemini/` route does not support image generation yet. Let us know if you need this feature by opening an issue at https://github.com/BerriAI/litellm/issues"
)
else:
raise ValueError(f"Unsupported mode: {mode}")
return url, endpoint
def _check_text_in_content(parts: list[PartType]) -> bool:
"""
check that user_content has 'text' parameter.
- Known Vertex Error: Unable to submit request because it must have a text parameter.
- 'text' param needs to be present (empty strings are valid)
- Relevant Issue: https://github.com/BerriAI/litellm/issues/5515
"""
has_text_param = False
for part in parts:
if "text" in part and part.get("text") is not None:
has_text_param = True
return has_text_param
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use a supported mode for this Vertex AI route.
- Check the model/call combination against litellm docs.
Example fix
# choose a supported mode for the gemini/ route.
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when an unsupported mode is passed to Vertex AI common utils.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/5bcaf4473fb02f2d.
Report an issue: GitHub.