BerriAI/litellm · error · ValueError
Amazon Nova Canvas {task_type} requires a text prompt. Pass
Error message
Amazon Nova Canvas {task_type} requires a text prompt. Pass a non-empty `prompt` in your request. What it means
Bedrock's Nova Canvas INPAINTING and OUTPAINTING tasks require a non-empty text prompt (it drives the mask semantics / area description). After popping taskType, the transformer checks prompt and raises ValueError when it is None or '' for those two task types; other tasks fall back to a single-space text.
Source
Thrown at litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py:352
if width is not None:
image_generation_config["width"] = width
if height is not None:
image_generation_config["height"] = height
if number_of_images is not None:
image_generation_config["numberOfImages"] = number_of_images
if quality is not None:
image_generation_config["quality"] = quality
if cfg_scale is not None:
image_generation_config["cfgScale"] = cfg_scale
if seed is not None:
image_generation_config["seed"] = seed
task_type: Final = op.pop("taskType", None)
if (prompt is None or prompt == "") and task_type in (
"INPAINTING",
"OUTPAINTING",
):
raise ValueError(
f"Amazon Nova Canvas {task_type} requires a text prompt. Pass a non-empty `prompt` in your request."
)
text: Final = prompt if prompt is not None and prompt != "" else " "
negative_text: Final = op.pop("negativeText", None)
similarity_strength: Final = op.pop("similarityStrength", None)
mask_prompt: Final = op.pop("maskPrompt", None)
out_painting_mode: Final = op.pop("outPaintingMode", None)
body: Final = _nova_canvas_task_body(
image_b64=image_b64,
mask_b64=mask_b64,
text=text,
negative_text=negative_text,
similarity_strength=similarity_strength,
task_type=task_type,
mask_prompt=mask_prompt,
out_painting_mode=out_painting_mode,
)View on GitHub (pinned to 6c2dcb801b)
Solutions
- Supply a meaningful non-empty prompt describing what to paint into the masked area (or, for outpainting, how to extend the scene).
- Double-check the field name is 'prompt' in the multipart request.
- If you genuinely want no text, use IMAGE_VARIATION or BACKGROUND_REMOVAL, which tolerate a default text.
Example fix
# before
litellm.image_edit(model="bedrock/nova-canvas", image=img,
taskType="INPAINTING", maskPrompt="sky", prompt="") # ValueError
# after
litellm.image_edit(model="bedrock/nova-canvas", image=img,
taskType="INPAINTING", maskPrompt="sky",
prompt="fill with blue sky") Defensive patterns
Strategy: validation
Validate before calling
def validate_prompt_for_task(prompt: str | None, task_type: str | None) -> None:
if task_type in ("INPAINTING", "OUTPAINTING") and (prompt is None or prompt == ""):
raise ValueError(f"{task_type} requires a non-empty prompt") Prevention
- Require non-empty prompt strings in your form/API layer for edit endpoints.
- Treat empty prompt as a client bug, not a default.
- Document per-task prompt requirements next to taskType constants.
When it happens
Trigger: images/edits with taskType='INPAINTING' or 'OUTPAINTING' and prompt omitted, None, or empty string; prompt stripped by upstream validation before reaching litellm.
Common situations: Mask-only inpainting requests carried over from OpenAI (where prompt is also required but sometimes faked as ''); building edit requests programmatically where prompt defaults to None; prompt passed under a different key name.
Related errors
- OUTPAINTING requires either a mask image or a mask prompt. P
- Unsupported Amazon Nova Canvas taskType: {task_type!r}. Use
- 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
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/fc73a68afe95b709.
Report an issue: GitHub.