{"record":{"id":"f0bc3c7c6e72714f","repo":"BerriAI/litellm","slug":"cannot-specify-both-mask-and-mask","errorCode":null,"errorMessage":"Cannot specify both 'mask' and 'mask[]'","messagePattern":"Cannot specify both 'mask' and 'mask\\[\\]'","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"litellm/proxy/image_endpoints/endpoints.py","lineNumber":252,"sourceCode":"    model: str | None = None,\n):\n    \"\"\"\n    Follows the OpenAI Images API spec: https://platform.openai.com/docs/api-reference/images/create\n\n    ```bash\n    curl -s -D >(grep -i x-request-id >&2) \\\n    -o >(jq -r '.data[0].b64_json' | base64 --decode > gift-basket.png) \\\n    -X POST \"http://localhost:4000/v1/images/edits\" \\\n    -H \"Authorization: Bearer sk-1234\" \\\n        -F \"model=gpt-image-1\" \\\n        -F \"image[]=@soap.png\" \\\n        -F 'prompt=Create a studio ghibli image of this'\n    ```\n    \"\"\"\n    if image is not None and image_array is not None:\n        raise HTTPException(status_code=422, detail=\"Cannot specify both 'image' and 'image[]'\")\n    if mask is not None and mask_array is not None:\n        raise HTTPException(status_code=422, detail=\"Cannot specify both 'mask' and 'mask[]'\")\n    if image is None and image_array is not None:\n        image = image_array\n    if mask is None and mask_array is not None:\n        mask = mask_array\n\n    # if image is None:\n    #     raise HTTPException(status_code=422, detail=\"Field required: image\")\n    # Note: Image is optional for some models (e.g., Bedrock Stability style-transfer)\n    # The validation will be done at the model level if image is truly required\n\n    from litellm.proxy.proxy_server import (\n        _read_request_body,\n        general_settings,\n        llm_router,\n        proxy_config,\n        proxy_logging_obj,\n        select_data_generator,\n        user_api_base,","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/image_endpoints/endpoints.py#L234-L270","documentation":"Error \"Cannot specify both 'mask' and 'mask[]'\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/image_endpoints/endpoints.py:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send either 'mask' or 'mask[]' in the request, not both."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}