BerriAI/litellm · error · OpenAIError

raw_response.text

Error message

raw_response.text

What it means

Error "raw_response.text" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/openai/image_edit/transformation.py:152

                mask_content_type: Final[str] = ImageEditRequestUtils.get_image_content_type(_mask)
                if isinstance(_mask, BufferedReader):
                    files_list.append(("mask", (_mask.name, _mask, mask_content_type)))
                else:
                    files_list.append(("mask", ("mask.png", _mask, mask_content_type)))

        return data_without_files, files_list

    def transform_image_edit_response(
        self,
        model: str,
        raw_response: httpx.Response,
        logging_obj: LiteLLMLoggingObj,
    ) -> ImageResponse:
        """No transform applied since outputs are in OpenAI spec already"""
        try:
            raw_response_json: Final = raw_response.json()
        except Exception:
            raise OpenAIError(message=raw_response.text, status_code=raw_response.status_code)
        return ImageResponse(**raw_response_json)

    def validate_environment(
        self,
        headers: dict,
        model: str,
        api_key: str | None = None,
        litellm_params: dict | None = None,
        api_base: str | None = None,
    ) -> dict:
        api_key = api_key or litellm.api_key or litellm.openai_key or get_secret_str("OPENAI_API_KEY")
        headers.update(
            {
                "Authorization": f"Bearer {api_key}",
            }
        )
        return headers

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the OpenAI image edit error response body.

When it happens

Trigger: Thrown at litellm/llms/openai/image_edit/transformation.py:152 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/4780f191ce2f4099. Report an issue: GitHub.