{"record":{"id":"57147c7d7f219584","repo":"BerriAI/litellm","slug":"unable-to-infer-mime-type-from-gcs-url-gcs-url","errorCode":null,"errorMessage":"Unable to infer MIME type from GCS URL: {gcs_url}. Supported extensions: {', '.join(extension_to_mime.keys())}","messagePattern":"Unable to infer MIME type from GCS URL: (.+?)\\. Supported extensions: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py","lineNumber":82,"sourceCode":"        ValueError: If file extension is not supported\n    \"\"\"\n    extension_to_mime: Final = {\n        \".png\": \"image/png\",\n        \".jpg\": \"image/jpeg\",\n        \".jpeg\": \"image/jpeg\",\n        \".mp3\": \"audio/mpeg\",\n        \".wav\": \"audio/wav\",\n        \".mp4\": \"video/mp4\",\n        \".mov\": \"video/quicktime\",\n        \".pdf\": \"application/pdf\",\n    }\n\n    gcs_url_lower: Final = gcs_url.lower()\n    for ext, mime_type in extension_to_mime.items():\n        if gcs_url_lower.endswith(ext):\n            return mime_type\n\n    raise ValueError(\n        f\"Unable to infer MIME type from GCS URL: {gcs_url}. \"\n        f\"Supported extensions: {', '.join(extension_to_mime.keys())}\"\n    )\n\n\ndef _parse_data_url(data_url: str) -> tuple[str, str]:\n    \"\"\"\n    Parse a data URL to extract the media type and base64 data.\n\n    Args:\n        data_url: Data URL in format: data:image/jpeg;base64,/9j/4AAQ...\n\n    Returns:\n        tuple: (media_type, base64_data)\n            media_type: e.g., \"image/jpeg\", \"video/mp4\", \"audio/mpeg\"\n            base64_data: The base64-encoded data without the prefix\n\n    Raises:","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py#L64-L100","documentation":"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.","triggerScenarios":"Triggered when the MIME type cannot be inferred from the GCS URL extension for Gemini batch embedding.","commonSituations":"See trigger scenarios.","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."],"exampleFix":"# use e.g. .pdf, .png, .jpg files in the GCS URL.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}