{"record":{"id":"ac2c8a503a29a343","repo":"BerriAI/litellm","slug":"task-type-task-type-is-not-supported","errorCode":null,"errorMessage":"Task type {task_type} is not supported","messagePattern":"Task type (.+?) is not supported","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/image_generation/amazon_nova_canvas_transformation.py","lineNumber":148,"sourceCode":"                inpainting_params_typed: Final = AmazonNovaCanvasInpaintingParams(**inpainting_params)\n            except Exception as e:\n                raise ValueError(\n                    f\"Error transforming inpainting params: {e}. Got params: {inpainting_params}, Expected params: {AmazonNovaCanvasInpaintingParams.__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 AmazonNovaCanvasInpaintingRequest(\n                taskType=task_type,\n                inpaintingParams=inpainting_params_typed,\n                imageGenerationConfig=image_generation_config_typed,\n            )\n        raise NotImplementedError(f\"Task type {task_type} is not supported\")\n\n    @classmethod\n    def map_openai_params(cls, non_default_params: dict, optional_params: dict) -> dict:\n        \"\"\"\n        Map the OpenAI params to the Bedrock params\n        \"\"\"\n        _size: Final = non_default_params.get(\"size\")\n        if _size is not None:\n            width, height = _size.split(\"x\")\n            optional_params[\"width\"], optional_params[\"height\"] = (\n                int(width),\n                int(height),\n            )\n        if non_default_params.get(\"n\") is not None:\n            optional_params[\"numberOfImages\"] = non_default_params.get(\"n\")\n        if non_default_params.get(\"quality\") is not None:\n            if non_default_params.get(\"quality\") in (\"hd\", \"premium\"):\n                optional_params[\"quality\"] = \"premium\"","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/image_generation/amazon_nova_canvas_transformation.py#L130-L166","documentation":"Raised by AmazonNovaCanvasConfig.transform_request_body when the taskType supplied in optional_params does not match one of the three implemented Nova Canvas tasks: TEXT_IMAGE, COLOR_GUIDED_GENERATION, or INPAINTING. LiteLLM builds a different typed Bedrock request per task; any other value falls through every branch and hits the final raise NotImplementedError. taskType defaults to 'TEXT_IMAGE' when omitted, so this only fires when an explicit unsupported or misspelled value was passed.","triggerScenarios":"Calling litellm.image() with model like 'amazon.nova-canvas-v1:0' and optional_params taskType set to a value the AWS docs list but LiteLLM does not implement (e.g. 'OUTPAINTING', 'BACKGROUND_REMOVAL', 'IMAGE_VARIATION'), or a casing typo like 'text_image'.","commonSituations":"Copying taskType values from the AWS Nova Canvas console/docs, which support more tasks than this transformation implements; assuming OpenAI param names map directly; AWS shipping a new task type before LiteLLM adds support.","solutions":["Set taskType to one of TEXT_IMAGE, COLOR_GUIDED_GENERATION, or INPAINTING, or omit it entirely to get the TEXT_IMAGE default","Check the branch conditions in litellm/llms/bedrock/image_generation/amazon_nova_canvas_transformation.py to see exactly which task types your LiteLLM version implements","For unsupported tasks, call Bedrock InvokeModel via boto3 directly, or upgrade litellm / open an issue requesting the task type"],"exampleFix":"// before\nlitellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", prompt=\"a cat\", taskType=\"OUTPAINTING\", ...)\n\n// after (use a supported task type, or omit for TEXT_IMAGE default)\nlitellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", prompt=\"a cat\")","handlingStrategy":"validation","validationCode":"SUPPORTED_NOVA_TASKS = {\"TEXT_IMAGE\", \"COLOR_GUIDED_GENERATION\", \"INPAINTING\"}\nparams = {\"prompt\": \"a cat\", \"taskType\": \"INPAINTING\", \"maskImage\": mask_b64}\nif params.get(\"taskType\", \"TEXT_IMAGE\") not in SUPPORTED_NOVA_TASKS:\n    raise ValueError(f\"Unsupported Nova Canvas taskType; choose from {sorted(SUPPORTED_NOVA_TASKS)}\")\nlitellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", **params)","typeGuard":"def is_supported_nova_canvas_task(task_type: str | None) -> bool:\n    \"\"\"True when taskType is implemented by AmazonNovaCanvasConfig.\"\"\"\n    return task_type in {\"TEXT_IMAGE\", \"COLOR_GUIDED_GENERATION\", \"INPAINTING\"}","tryCatchPattern":"try:\n    resp = litellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", prompt=p, taskType=task)\nexcept NotImplementedError:\n    # fall back to the default task or surface a config error\n    resp = litellm.image(model=\"bedrock/amazon.nova-canvas-v1:0\", prompt=p)","preventionTips":["Keep taskType values in a constant set shared by config and code instead of inline strings","Omit taskType for plain text-to-image; the default TEXT_IMAGE is the safest path","Pin and periodically re-check which task types your litellm version implements before adopting new AWS features"],"tags":["bedrock","nova-canvas","image-generation","invalid-parameter"],"backgroundTag":"unsupported-parameter-value","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}