BerriAI/litellm · error · ValueError
Unsupported image type: {type(image)}
Error message
Unsupported image type: {type(image)} What it means
Error "Unsupported image type: {type(image)}" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/azure_ai/image_edit/flux2_transformation.py:141
return request_body, []
def _convert_image_to_base64(self, image: Any) -> str:
"""Convert image file to base64 string"""
# Handle list of images (take first one)
if isinstance(image, list):
if len(image) == 0:
raise ValueError("Empty image list provided")
image = image[0]
if isinstance(image, BufferedReader):
image_bytes = image.read()
image.seek(0) # Reset file pointer for potential reuse
elif isinstance(image, bytes):
image_bytes = image
elif hasattr(image, "read"):
image_bytes = image.read()
else:
raise ValueError(f"Unsupported image type: {type(image)}")
return base64.b64encode(image_bytes).decode("utf-8")
def get_complete_url(
self,
model: str,
api_base: str | None,
litellm_params: dict,
) -> str:
"""
Constructs a complete URL for Azure AI Foundry FLUX 2 image edits.
Uses the same /providers/blackforestlabs/v1/flux-2-pro endpoint as image generation.
"""
api_base = AzureFoundryModelInfo.get_api_base(api_base)
if api_base is None:
raise ValueError(View on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass the image as bytes, a file-like object, or a supported type.
When it happens
Trigger: Thrown at litellm/llms/azure_ai/image_edit/flux2_transformation.py:141 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/ace3b71786dd0aaf.
Report an issue: GitHub.