BerriAI/litellm · error · HTTPException
Cannot specify both 'image' and 'image[]'
Error message
Cannot specify both 'image' and 'image[]'
What it means
Error "Cannot specify both 'image' and 'image[]'" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/image_endpoints/endpoints.py:250
mask: list[UploadFile] | None = File(None),
mask_array: list[UploadFile] | None = File(None, alias="mask[]"),
model: str | None = None,
):
"""
Follows the OpenAI Images API spec: https://platform.openai.com/docs/api-reference/images/create
```bash
curl -s -D >(grep -i x-request-id >&2) \
-o >(jq -r '.data[0].b64_json' | base64 --decode > gift-basket.png) \
-X POST "http://localhost:4000/v1/images/edits" \
-H "Authorization: Bearer sk-1234" \
-F "model=gpt-image-1" \
-F "image[]=@soap.png" \
-F 'prompt=Create a studio ghibli image of this'
```
"""
if image is not None and image_array is not None:
raise HTTPException(status_code=422, detail="Cannot specify both 'image' and 'image[]'")
if mask is not None and mask_array is not None:
raise HTTPException(status_code=422, detail="Cannot specify both 'mask' and 'mask[]'")
if image is None and image_array is not None:
image = image_array
if mask is None and mask_array is not None:
mask = mask_array
# if image is None:
# raise HTTPException(status_code=422, detail="Field required: image")
# Note: Image is optional for some models (e.g., Bedrock Stability style-transfer)
# The validation will be done at the model level if image is truly required
from litellm.proxy.proxy_server import (
_read_request_body,
general_settings,
llm_router,
proxy_config,
proxy_logging_obj,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Send either 'image' or 'image[]' in the request, not both.
When it happens
Trigger: Thrown at litellm/proxy/image_endpoints/endpoints.py:250 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/e3c87d935a4d61c4.
Report an issue: GitHub.