BerriAI/litellm · error · ValueError

FLUX 2 image edit requires an image.

Error message

FLUX 2 image edit requires an image.

What it means

Error "FLUX 2 image edit requires an image." thrown in BerriAI/litellm.

Source

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

        self,
        model: str,
        prompt: str | None,
        image: FileTypes | None,
        image_edit_optional_request_params: dict,
        litellm_params: GenericLiteLLMParams,
        headers: dict,
    ) -> tuple[dict, RequestFiles]:
        """
        Transform image edit request for FLUX 2.

        FLUX 2 uses the same endpoint for generation and editing,
        with the image passed as base64 in the JSON body.
        """
        if prompt is None:
            raise ValueError("FLUX 2 image edit requires a prompt.")

        if image is None:
            raise ValueError("FLUX 2 image edit requires an image.")

        image_b64: Final = self._convert_image_to_base64(image)

        # 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"""

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass an image for the FLUX 2 image edit request.

When it happens

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