{"record":{"id":"04642e8f30b950b9","repo":"BerriAI/litellm","slug":"invalid-size-format-size-expected-format-wi-04642e","errorCode":null,"errorMessage":"Invalid size format: '{size}'. Expected format 'WIDTHxHEIGHT' (e.g., '1024x1024').","messagePattern":"Invalid size format: '(.+?)'\\. Expected format 'WIDTHxHEIGHT' \\(e\\.g\\., '1024x1024'\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/image_generation/mai_transformation.py","lineNumber":186,"sourceCode":"        size_mapping: Final = {\n            \"1024x1024\": (1024, 1024),\n            \"1792x1024\": (1792, 1024),\n            \"1024x1792\": (1024, 1792),\n            \"512x512\": (512, 512),\n            \"256x256\": (256, 256),\n        }\n\n        if size in size_mapping:\n            width, height = size_mapping[size]\n            optional_params[\"width\"] = width\n            optional_params[\"height\"] = height\n        elif \"x\" in size:\n            try:\n                width, height = map(int, size.lower().split(\"x\"))\n                optional_params[\"width\"] = width\n                optional_params[\"height\"] = height\n            except ValueError:\n                raise ValueError(f\"Invalid size format: '{size}'. Expected format 'WIDTHxHEIGHT' (e.g., '1024x1024').\")\n        else:\n            raise ValueError(\n                f\"Unsupported size value: '{size}'. \"\n                f\"Use a known size (e.g., '1024x1024') or a custom 'WIDTHxHEIGHT' string.\"\n            )\n\n    def transform_image_generation_response(\n        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: ImageResponse,\n        logging_obj: \"LiteLLMLoggingObj\",\n        request_data: dict,\n        optional_params: dict,\n        litellm_params: dict,\n        encoding: Any,\n        api_key: str | None = None,\n        json_mode: bool | None = None,","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/image_generation/mai_transformation.py#L168-L204","documentation":"Error \"Invalid size format: '{size}'. Expected format 'WIDTHxHEIGHT' (e.g., '1024x1024').\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/image_generation/mai_transformation.py:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the 'WIDTHxHEIGHT' format, e.g. '1024x1024'."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}