BerriAI/litellm · error · ValueError

Empty image list provided

Error message

Empty image list provided

What it means

Error "Empty image list provided" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/azure_ai/image_edit/flux2_transformation.py:130

        # Build request body with required params
        request_body: Final[dict[str, Any]] = {
            "prompt": prompt,
            "image": image_b64,
            "model": model,
        }

        # Add mapped optional params (already filtered by map_openai_params)
        request_body.update(image_edit_optional_request_params)

        # Return JSON body and empty files list (FLUX 2 doesn't use multipart)
        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,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass a non-empty image list.

When it happens

Trigger: Thrown at litellm/llms/azure_ai/image_edit/flux2_transformation.py:130 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/c9bb508e6bf26792. Report an issue: GitHub.