BerriAI/litellm · error · ValueError
Unsupported Amazon Nova Canvas taskType: {task_type!r}. Use
Error message
Unsupported Amazon Nova Canvas taskType: {task_type!r}. Use BACKGROUND_REMOVAL, OUTPAINTING, IMAGE_VARIATION, INPAINTING, or omit taskType for automatic routing (mask → INPAINTING, else IMAGE_VARIATION). What it means
The Nova Canvas image-edit transformation only accepts taskType values BACKGROUND_REMOVAL, OUTPAINTING, IMAGE_VARIATION, and INPAINTING (or no taskType for automatic routing). Any other non-empty taskType reaching the final validation branch raises this ValueError listing the allowed values.
Source
Thrown at litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py:97
# Honour explicit IMAGE_VARIATION even when a mask is present (mask is ignored
# for this task type; callers use INPAINTING when they want mask semantics).
if task_type == "IMAGE_VARIATION":
var_params_explicit: Final[dict[str, Any]] = {
"images": [image_b64],
"text": text,
}
if negative_text is not None:
var_params_explicit["negativeText"] = negative_text
if similarity_strength is not None:
var_params_explicit["similarityStrength"] = similarity_strength
return {
"taskType": "IMAGE_VARIATION",
"imageVariationParams": var_params_explicit,
}
# Explicit taskType must be INPAINTING or omitted from here on; anything else is invalid.
if task_type is not None and str(task_type).strip() != "":
if task_type != "INPAINTING":
raise ValueError(
f"Unsupported Amazon Nova Canvas taskType: {task_type!r}. "
"Use BACKGROUND_REMOVAL, OUTPAINTING, IMAGE_VARIATION, INPAINTING, "
"or omit taskType for automatic routing (mask → INPAINTING, else IMAGE_VARIATION)."
)
if mask_b64 is not None or mask_prompt is not None or task_type == "INPAINTING":
in_params: Final[dict[str, Any]] = {"image": image_b64, "text": text}
if mask_prompt is not None:
in_params["maskPrompt"] = mask_prompt
elif mask_b64 is not None:
in_params["maskImage"] = mask_b64
if negative_text is not None:
in_params["negativeText"] = negative_text
if "maskPrompt" not in in_params and "maskImage" not in in_params:
raise ValueError(
"Amazon Nova Canvas INPAINTING requires either maskPrompt or maskImage "
"(use OpenAI mask= for maskImage, or pass maskPrompt in optional params). "
"See https://docs.aws.amazon.com/nova/latest/userguide/image-gen-req-resp-structure.html"
)View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set taskType to one of BACKGROUND_REMOVAL, OUTPAINTING, IMAGE_VARIATION, INPAINTING (exact uppercase), or omit it for auto routing.
- For background removal, remember only BACKGROUND_REMOVAL needs no mask and no text prompt requirements differ per task.
- If you wanted color-guided generation, use the image-generation endpoint (litellm.image / /v1/images/generations), not /v1/images/edits.
Example fix
# before
optional_params={"taskType": "COLOR_GUIDED_GENERATION"} # edits -> ValueError
# after
optional_params={"taskType": "INPAINTING", "maskPrompt": "the sky"}
# or omit taskType entirely Defensive patterns
Strategy: validation
Validate before calling
EDIT_TASK_TYPES = {"BACKGROUND_REMOVAL", "OUTPAINTING", "IMAGE_VARIATION", "INPAINTING"}
def valid_edit_task_type(tt: str | None) -> bool:
return tt is None or (isinstance(tt, str) and tt.strip() in EDIT_TASK_TYPES or tt in EDIT_TASK_TYPES) Type guard
def is_nova_edit_task_type(tt: object) -> bool:
return isinstance(tt, str) and tt in {
"BACKGROUND_REMOVAL", "OUTPAINTING", "IMAGE_VARIATION", "INPAINTING"
} Prevention
- Keep an enum/constant set of edit task types and validate against it client-side.
- Remember generation taskTypes (COLOR_GUIDED_GENERATION, TEXT_IMAGE) are invalid on /images/edits.
- Use exact uppercase strings; casing is not normalized.
When it happens
Trigger: Passing taskType values valid for Nova text-to-image but not edits (e.g. 'COLOR_GUIDED_GENERATION', 'TEXT_IMAGE'), or casing/typo variants like 'inpainting', 'Inpainting', 'WATERMARK' in an images/edits call on a nova-canvas model.
Common situations: Copy-pasting a taskType from a Nova Canvas image-generation payload into an image-edit request; assuming the generation taskType enum applies to edits; sending whitespace-padded values is tolerated but wrong casing is not.
Related errors
- OUTPAINTING requires either a mask image or a mask prompt. P
- Amazon Nova Canvas INPAINTING requires either maskPrompt or
- Nova Canvas image edit requires an image input
- Nova Canvas image edit does not support tuple FileTypes. Pas
- Amazon Nova Canvas {task_type} requires a text prompt. Pass
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/f718b9fcd87f7048.
Report an issue: GitHub.