{"record":{"id":"ace3b71786dd0aaf","repo":"BerriAI/litellm","slug":"unsupported-image-type-type-image","errorCode":null,"errorMessage":"Unsupported image type: {type(image)}","messagePattern":"Unsupported image type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/image_edit/flux2_transformation.py","lineNumber":141,"sourceCode":"        return request_body, []\n\n    def _convert_image_to_base64(self, image: Any) -> str:\n        \"\"\"Convert image file to base64 string\"\"\"\n        # Handle list of images (take first one)\n        if isinstance(image, list):\n            if len(image) == 0:\n                raise ValueError(\"Empty image list provided\")\n            image = image[0]\n\n        if isinstance(image, BufferedReader):\n            image_bytes = image.read()\n            image.seek(0)  # Reset file pointer for potential reuse\n        elif isinstance(image, bytes):\n            image_bytes = image\n        elif hasattr(image, \"read\"):\n            image_bytes = image.read()\n        else:\n            raise ValueError(f\"Unsupported image type: {type(image)}\")\n\n        return base64.b64encode(image_bytes).decode(\"utf-8\")\n\n    def get_complete_url(\n        self,\n        model: str,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"\n        Constructs a complete URL for Azure AI Foundry FLUX 2 image edits.\n\n        Uses the same /providers/blackforestlabs/v1/flux-2-pro endpoint as image generation.\n        \"\"\"\n        api_base = AzureFoundryModelInfo.get_api_base(api_base)\n\n        if api_base is None:\n            raise ValueError(","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/image_edit/flux2_transformation.py#L123-L159","documentation":"Error \"Unsupported image type: {type(image)}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/image_edit/flux2_transformation.py:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the image as bytes, a file-like object, or a supported type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}