{"record":{"id":"54a4de07352a1af2","repo":"BerriAI/litellm","slug":"error-transforming-color-guided-generation-params","errorCode":null,"errorMessage":"Error transforming color guided generation params: {e}. Got params: {color_guided_generation_params}, Expected params: {AmazonNovaCanvasColorGuidedGenerationParams.__annotations__}","messagePattern":"Error transforming color guided generation params: (.+?)\\. Got params: (.+?), Expected params: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/image_generation/amazon_nova_canvas_transformation.py","lineNumber":110,"sourceCode":"            return AmazonNovaCanvasTextToImageRequest(\n                textToImageParams=text_to_image_params_typed,\n                taskType=task_type,\n                imageGenerationConfig=image_generation_config_typed,\n            )\n        if task_type == \"COLOR_GUIDED_GENERATION\":\n            color_guided_generation_params: dict[str, Any] = image_generation_config.pop(\n                \"colorGuidedGenerationParams\", {}\n            )\n            color_guided_generation_params = {\n                \"text\": text,\n                **color_guided_generation_params,\n            }\n            try:\n                color_guided_generation_params_typed: Final = AmazonNovaCanvasColorGuidedGenerationParams(\n                    **color_guided_generation_params\n                )\n            except Exception as e:\n                raise ValueError(\n                    f\"Error transforming color guided generation params: {e}. Got params: {color_guided_generation_params}, Expected params: {AmazonNovaCanvasColorGuidedGenerationParams.__annotations__}\"\n                )\n\n            try:\n                image_generation_config_typed = AmazonNovaCanvasImageGenerationConfig(**image_generation_config)\n            except Exception as e:\n                raise ValueError(\n                    f\"Error transforming image generation config: {e}. Got params: {image_generation_config}, Expected params: {AmazonNovaCanvasImageGenerationConfig.__annotations__}\"\n                )\n\n            return AmazonNovaCanvasColorGuidedRequest(\n                taskType=task_type,\n                colorGuidedGenerationParams=color_guided_generation_params_typed,\n                imageGenerationConfig=image_generation_config_typed,\n            )\n        if task_type == \"INPAINTING\":\n            inpainting_params: dict[str, Any] = image_generation_config.pop(\"inpaintingParams\", {})\n            inpainting_params = {\"text\": text, **inpainting_params}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/image_generation/amazon_nova_canvas_transformation.py#L92-L128","documentation":"For task COLOR_GUIDED_GENERATION, the popped colorGuidedGenerationParams dict is merged with text and validated against AmazonNovaCanvasColorGuidedGenerationParams. Any constructor error (missing/bad 'text', invalid 'colors' entries, unknown keys, wrong types) is re-raised as this ValueError with the received and expected shapes.","triggerScenarios":"litellm.image(task='COLOR_GUIDED_GENERATION', ...) with colorGuidedGenerationParams containing invalid keys, colors not as list of hex strings, referenceImage malformed, or no usable text prompt.","commonSituations":"Copying AWS console JSON examples with different key casing; passing 'colors' as a comma string instead of a list; empty prompt so merged text is empty/None.","solutions":["Align colorGuidedGenerationParams with the expected keys shown in the error: text (str), colors (list of hex strings), negativeText, referenceImage where supported.","Provide a non-empty prompt so 'text' is valid.","Validate hex color format ('#RRGGBB') client-side before sending."],"exampleFix":"# before\nlitellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", task=\"COLOR_GUIDED_GENERATION\",\n             prompt=\"brand logo\", colorGuidedGenerationParams={\"colors\": \"#FF0000, #00FF00\"})\n# after\nlitellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", task=\"COLOR_GUIDED_GENERATION\",\n             prompt=\"brand logo\",\n             colorGuidedGenerationParams={\"colors\": [\"#FF0000\", \"#00FF00\"]})","handlingStrategy":"validation","validationCode":"import re\n\nHEX = re.compile(r\"^#[0-9A-Fa-f]{6}$\")\n\ndef valid_color_guided_params(p: dict, prompt: str | None) -> bool:\n    colors = p.get(\"colors\", [])\n    return (\n        isinstance(prompt, str) and prompt != \"\"\n        and isinstance(colors, list)\n        and all(isinstance(c, str) and HEX.match(c) for c in colors)\n    )","typeGuard":"def is_hex_color_list(v: object) -> bool:\n    import re\n    return (\n        isinstance(v, list)\n        and all(isinstance(c, str) and re.fullmatch(r\"#[0-9A-Fa-f]{6}\", c) for c in v)\n    )","tryCatchPattern":null,"preventionTips":["Pass colors as a list of '#RRGGBB' hex strings, never a comma-joined string.","Always include a non-empty prompt for COLOR_GUIDED_GENERATION.","Validate nested task params with a JSON schema before they reach litellm."],"tags":["bedrock","nova-canvas","image-generation","color-guided","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}