BerriAI/litellm · error · NotImplementedError

Task type is not supported

Error message

Task type {task_type} is not supported

What it means

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.

Solutions

  1. Set taskType to one of TEXT_IMAGE, COLOR_GUIDED_GENERATION, or INPAINTING, or omit it entirely to get the TEXT_IMAGE default
  2. 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
  3. For unsupported tasks, call Bedrock InvokeModel via boto3 directly, or upgrade litellm / open an issue requesting the task type

Example fix

// before
litellm.image(model="bedrock/amazon.nova-canvas-v1:0", prompt="a cat", taskType="OUTPAINTING", ...)

// after (use a supported task type, or omit for TEXT_IMAGE default)
litellm.image(model="bedrock/amazon.nova-canvas-v1:0", prompt="a cat")
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_NOVA_TASKS = {"TEXT_IMAGE", "COLOR_GUIDED_GENERATION", "INPAINTING"}
params = {"prompt": "a cat", "taskType": "INPAINTING", "maskImage": mask_b64}
if params.get("taskType", "TEXT_IMAGE") not in SUPPORTED_NOVA_TASKS:
    raise ValueError(f"Unsupported Nova Canvas taskType; choose from {sorted(SUPPORTED_NOVA_TASKS)}")
litellm.image(model="bedrock/amazon.nova-canvas-v1:0", **params)

Type guard

def is_supported_nova_canvas_task(task_type: str | None) -> bool:
    """True when taskType is implemented by AmazonNovaCanvasConfig."""
    return task_type in {"TEXT_IMAGE", "COLOR_GUIDED_GENERATION", "INPAINTING"}

Try / catch

try:
    resp = litellm.image(model="bedrock/amazon.nova-canvas-v1:0", prompt=p, taskType=task)
except NotImplementedError:
    # fall back to the default task or surface a config error
    resp = litellm.image(model="bedrock/amazon.nova-canvas-v1:0", prompt=p)

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ac2c8a503a29a343. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/image_generation/amazon_nova_canvas_transformation.py:148

                inpainting_params_typed: Final = AmazonNovaCanvasInpaintingParams(**inpainting_params)
            except Exception as e:
                raise ValueError(
                    f"Error transforming inpainting params: {e}. Got params: {inpainting_params}, Expected params: {AmazonNovaCanvasInpaintingParams.__annotations__}"
                )

            try:
                image_generation_config_typed = AmazonNovaCanvasImageGenerationConfig(**image_generation_config)
            except Exception as e:
                raise ValueError(
                    f"Error transforming image generation config: {e}. Got params: {image_generation_config}, Expected params: {AmazonNovaCanvasImageGenerationConfig.__annotations__}"
                )

            return AmazonNovaCanvasInpaintingRequest(
                taskType=task_type,
                inpaintingParams=inpainting_params_typed,
                imageGenerationConfig=image_generation_config_typed,
            )
        raise NotImplementedError(f"Task type {task_type} is not supported")

    @classmethod
    def map_openai_params(cls, non_default_params: dict, optional_params: dict) -> dict:
        """
        Map the OpenAI params to the Bedrock params
        """
        _size: Final = non_default_params.get("size")
        if _size is not None:
            width, height = _size.split("x")
            optional_params["width"], optional_params["height"] = (
                int(width),
                int(height),
            )
        if non_default_params.get("n") is not None:
            optional_params["numberOfImages"] = non_default_params.get("n")
        if non_default_params.get("quality") is not None:
            if non_default_params.get("quality") in ("hd", "premium"):
                optional_params["quality"] = "premium"

View on GitHub (pinned to 77b7c6c40c)