BerriAI/litellm · error · ValueError
Amazon Nova Canvas requires a text prompt. Pass a non-empty…
Error message
Amazon Nova Canvas {task_type} requires a text prompt. Pass a non-empty `prompt` in your request. What it means
AWS requires a non-empty text prompt for Nova Canvas INPAINTING and OUTPAINTING tasks (the prompt describes the edit to apply inside/outside the mask). LiteLLM checks this after popping taskType; for other task types an empty prompt is silently replaced with a single space, but for these two it raises before building the body.
Solutions
- Pass a descriptive non-empty prompt, e.g. prompt='fill the masked area with foliage'
- If you only want background removal, use taskType='BACKGROUND_REMOVAL', which needs no prompt
- Guard prompt construction: prompt = user_text or default_edit_instruction
Example fix
# before
resp = litellm.image_edit(
model="bedrock/amazon.nova-canvas-v1:0",
image=open("cat.png", "rb"),
mask=open("mask.png", "rb"),
taskType="INPAINTING",
prompt="",
)
# after
resp = litellm.image_edit(
model="bedrock/amazon.nova-canvas-v1:0",
image=open("cat.png", "rb"),
mask=open("mask.png", "rb"),
taskType="INPAINTING",
prompt="replace the masked area with flowers",
) Defensive patterns
Strategy: validation
Validate before calling
PROMPT_REQUIRED_TASKS = {"INPAINTING", "OUTPAINTING"}
if kwargs.get("taskType") in PROMPT_REQUIRED_TASKS and not (prompt or "").strip():
raise ValueError("INPAINTING/OUTPAINTING need a non-empty prompt") Type guard
def has_required_prompt(task_type: str | None, prompt: str | None) -> bool:
"""True when the prompt satisfies the task's requirement."""
if task_type in ("INPAINTING", "OUTPAINTING"):
return bool(prompt and prompt.strip())
return True Try / catch
try:
resp = litellm.image_edit(...)
except ValueError as e:
if "requires a text prompt" in str(e):
raise UserInputError("Describe the edit you want applied to the masked area") from e
raise Prevention
- Default empty prompts to a task-appropriate instruction string in your UI layer
- Add form validation that blocks empty instructions for mask-based edits
- Skip prompt validation only for BACKGROUND_REMOVAL
When it happens
Trigger: taskType='INPAINTING' or 'OUTPAINTING' with prompt=None or prompt='' in litellm.image_edit (e.g. mask-only call with no edit instruction).
Common situations: Assuming the mask alone drives the edit; prompt variables rendered empty by templating/i18n; code paths that pass '' as a placeholder.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Amazon Nova Canvas INPAINTING requires either maskPrompt or…
- Nova Canvas image edit requires an image input
- OUTPAINTING requires either a mask image or a mask prompt…
- Unsupported Amazon Nova Canvas taskType
- Error transforming inpainting params
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/fc73a68afe95b709.
Report an issue: GitHub.
Appendix: 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 77b7c6c40c)