{"record":{"id":"8405783c31deb25d","repo":"BerriAI/litellm","slug":"imagevariationconfig-implements-transform-respons-840578","errorCode":null,"errorMessage":"ImageVariationConfig implements 'transform_response_image_variation' for image variation models","messagePattern":"ImageVariationConfig implements 'transform_response_image_variation' for image variation models","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/image_variations/transformation.py","lineNumber":130,"sourceCode":"        raise NotImplementedError(\n            \"ImageVariationConfig implementa 'transform_request_image_variation' for image variation models\"\n        )\n\n    def transform_response(\n        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: ModelResponse,\n        logging_obj: LiteLLMLoggingObj,\n        request_data: dict,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        encoding: Any,\n        api_key: str | None = None,\n        json_mode: bool | None = None,\n    ) -> ModelResponse:\n        raise NotImplementedError(\n            \"ImageVariationConfig implements 'transform_response_image_variation' for image variation models\"\n        )\n","sourceCodeStart":112,"sourceCodeEnd":133,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/image_variations/transformation.py#L112-L133","documentation":"Image-variations base config stub for the chat-style transform_response hook. Any attempt to parse an HTTP response through the generic (messages-based) response transformation on a variation config raises NotImplementedError, marking that path unsupported; variation responses must be handled by transform_response_image_variation.","triggerScenarios":"Generic response-processing code calls transform_response(model, raw_response, model_response, ..., messages, ...) on an ImageVariationConfig — e.g. a shared streaming/logging pipeline finishing a request that was mistakenly routed as a chat completion.","commonSituations":"Shared response handlers reused across modalities; misrouted proxy requests; provider subclasses that implement only the variation hooks but get exercised by completion tests.","solutions":["Use the variation response path (transform_response_image_variation) — i.e. call litellm.image_variation, not completion.","Override transform_response in the subclass if the generic signature must work.","Fix model-to-handler routing so variation models never enter chat response processing.","Add a registration test asserting each model's config supports the operation it is served for."],"exampleFix":"# before\nconfig.transform_response(model, raw_response, model_response, logging_obj, request_data, messages, ...)  # NotImplementedError\n\n# after\nconfig.transform_response_image_variation(model, raw_response, model_response, logging_obj, request_data, optional_params, litellm_params, encoding)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def has_variation_response_path(config) -> bool:\n    return callable(getattr(config, 'transform_response_image_variation', None))","tryCatchPattern":"try:\n    config.transform_response(...)\nexcept NotImplementedError:\n    return config.transform_response_image_variation(...)  # correct path","preventionTips":["Map each endpoint to its exact transform hook in one place (routing table).","Reject mismatched config/operation pairs early in request validation.","Log the config class name on NotImplementedError to speed up diagnosis."],"tags":["image-variation","not-implemented","response-parsing","dispatch"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}