{"record":{"id":"058c6aec5cec2dfd","repo":"BerriAI/litellm","slug":"invalid-image-received-image-url","errorCode":null,"errorMessage":"Invalid image received - {image_url}","messagePattern":"Invalid image received - (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/gemini/transformation.py","lineNumber":580,"sourceCode":"            # These URLs return 403 when accessed directly, so we must not try\n            # to resolve their MIME type via HTTP.\n            if format:\n                file_data = FileDataType(mime_type=format, file_uri=image_url)\n            else:\n                # Gemini Files API references can be passed through as URI-only.\n                file_data = cast(FileDataType, {\"file_uri\": image_url})\n            part = {\"file_data\": file_data}\n            return _apply_gemini_metadata(part, model, media_resolution_enum, video_metadata)\n        elif \"https://\" in image_url and (image_type := format or _get_image_mime_type_from_url(image_url)) is not None:\n            file_data = FileDataType(mime_type=image_type, file_uri=image_url)\n            part = {\"file_data\": file_data}\n            return _apply_gemini_metadata(part, model, media_resolution_enum, video_metadata)\n        elif \"http://\" in image_url or \"https://\" in image_url or \"base64\" in image_url:\n            image: Final = convert_to_anthropic_image_obj(image_url, format=format)\n            _blob: Final[BlobType] = {\"data\": image[\"data\"], \"mime_type\": image[\"media_type\"]}\n            part = {\"inline_data\": cast(BlobType, _blob)}\n            return _apply_gemini_metadata(part, model, media_resolution_enum, video_metadata)\n        raise Exception(f\"Invalid image received - {image_url}\")\n    except Exception as e:\n        raise e\n\n\ndef _snake_to_camel(snake_str: str) -> str:\n    \"\"\"Convert snake_case to camelCase\"\"\"\n    components: Final = snake_str.split(\"_\")\n    return components[0] + \"\".join(x.capitalize() for x in components[1:])\n\n\ndef _camel_to_snake(camel_str: str) -> str:\n    \"\"\"Convert camelCase to snake_case\"\"\"\n    return re.sub(r\"(?<!^)(?=[A-Z])\", \"_\", camel_str).lower()\n\n\ndef _get_equivalent_key(key: str, available_keys: set) -> str | None:\n    \"\"\"\n    Get the equivalent key from available keys, checking both camelCase and snake_case variants","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/gemini/transformation.py#L562-L598","documentation":"Gemini image-part guard: the image_url is neither a recognized provider URL, data URI, nor a resolvable file reference, so no fileData/inlineData part can be created and the image is rejected as invalid.","triggerScenarios":"Triggered when an invalid image URL/data is passed to the Vertex AI Gemini transformation.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid image URL or base64 data that can be fetched/decoded.","Check the image_url value for accessibility and correct format."],"exampleFix":"# verify the URL is reachable or use data:image/png;base64,... format.","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"}