BerriAI/litellm · error · ValueError
Unable to infer MIME type from GCS URL: {gcs_url}. Supported
Error message
Unable to infer MIME type from GCS URL: {gcs_url}. Supported extensions: {', '.join(extension_to_mime.keys())} What it means
Gemini embedding MIME inference guard: the GCS URL's extension is not in the supported set (.png/.jpg/.jpeg/.mp3/.wav/.mp4/.mov/.pdf), so no mime_type can be inferred for the fileData part and the URL is rejected.
Source
Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:82
ValueError: If file extension is not supported
"""
extension_to_mime: Final = {
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".mp3": "audio/mpeg",
".wav": "audio/wav",
".mp4": "video/mp4",
".mov": "video/quicktime",
".pdf": "application/pdf",
}
gcs_url_lower: Final = gcs_url.lower()
for ext, mime_type in extension_to_mime.items():
if gcs_url_lower.endswith(ext):
return mime_type
raise ValueError(
f"Unable to infer MIME type from GCS URL: {gcs_url}. "
f"Supported extensions: {', '.join(extension_to_mime.keys())}"
)
def _parse_data_url(data_url: str) -> tuple[str, str]:
"""
Parse a data URL to extract the media type and base64 data.
Args:
data_url: Data URL in format: data:image/jpeg;base64,/9j/4AAQ...
Returns:
tuple: (media_type, base64_data)
media_type: e.g., "image/jpeg", "video/mp4", "audio/mpeg"
base64_data: The base64-encoded data without the prefix
Raises:View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use a GCS URL whose extension maps to a supported MIME type (see the listed extensions).
- Rename or convert the file to a supported type.
Example fix
# use e.g. .pdf, .png, .jpg files in the GCS URL.
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when the MIME type cannot be inferred from the GCS URL extension for Gemini batch embedding.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/57147c7d7f219584.
Report an issue: GitHub.