diff --git a/litellm/llms/black_forest_labs/image_edit/handler.py b/litellm/llms/black_forest_labs/image_edit/handler.py index bd7809ec4b6..9bf92c874fd 100644 --- a/litellm/llms/black_forest_labs/image_edit/handler.py +++ b/litellm/llms/black_forest_labs/image_edit/handler.py @@ -121,7 +121,12 @@ class BlackForestLabsImageEdit: # Transform request # Handle image list vs single image - image_input = image[0] if isinstance(image, list) and image else image + if isinstance(image, list): + if not image: + raise BlackForestLabsError(status_code=400, message="No image provided") + image_input = image[0] + else: + image_input = image data, _ = self.config.transform_image_edit_request( model=model, prompt=prompt or "", @@ -219,7 +224,12 @@ class BlackForestLabsImageEdit: ) # Transform request - image_input = image[0] if isinstance(image, list) and image else image + if isinstance(image, list): + if not image: + raise BlackForestLabsError(status_code=400, message="No image provided") + image_input = image[0] + else: + image_input = image data, _ = self.config.transform_image_edit_request( model=model, prompt=prompt or "",