{"record":{"id":"fc73a68afe95b709","repo":"BerriAI/litellm","slug":"amazon-nova-canvas-task-type-requires-a-text-pro","errorCode":null,"errorMessage":"Amazon Nova Canvas {task_type} requires a text prompt. Pass a non-empty `prompt` in your request.","messagePattern":"Amazon Nova Canvas (.+?) requires a text prompt\\. Pass a non-empty `prompt` in your request\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py","lineNumber":352,"sourceCode":"        if width is not None:\n            image_generation_config[\"width\"] = width\n        if height is not None:\n            image_generation_config[\"height\"] = height\n        if number_of_images is not None:\n            image_generation_config[\"numberOfImages\"] = number_of_images\n        if quality is not None:\n            image_generation_config[\"quality\"] = quality\n        if cfg_scale is not None:\n            image_generation_config[\"cfgScale\"] = cfg_scale\n        if seed is not None:\n            image_generation_config[\"seed\"] = seed\n\n        task_type: Final = op.pop(\"taskType\", None)\n        if (prompt is None or prompt == \"\") and task_type in (\n            \"INPAINTING\",\n            \"OUTPAINTING\",\n        ):\n            raise ValueError(\n                f\"Amazon Nova Canvas {task_type} requires a text prompt. Pass a non-empty `prompt` in your request.\"\n            )\n        text: Final = prompt if prompt is not None and prompt != \"\" else \" \"\n        negative_text: Final = op.pop(\"negativeText\", None)\n        similarity_strength: Final = op.pop(\"similarityStrength\", None)\n        mask_prompt: Final = op.pop(\"maskPrompt\", None)\n        out_painting_mode: Final = op.pop(\"outPaintingMode\", None)\n\n        body: Final = _nova_canvas_task_body(\n            image_b64=image_b64,\n            mask_b64=mask_b64,\n            text=text,\n            negative_text=negative_text,\n            similarity_strength=similarity_strength,\n            task_type=task_type,\n            mask_prompt=mask_prompt,\n            out_painting_mode=out_painting_mode,\n        )","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py#L334-L370","documentation":"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.","triggerScenarios":"images/edits with taskType='INPAINTING' or 'OUTPAINTING' and prompt omitted, None, or empty string; prompt stripped by upstream validation before reaching litellm.","commonSituations":"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.","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."],"exampleFix":"# before\nlitellm.image_edit(model=\"bedrock/nova-canvas\", image=img,\n                  taskType=\"INPAINTING\", maskPrompt=\"sky\", prompt=\"\")  # ValueError\n# after\nlitellm.image_edit(model=\"bedrock/nova-canvas\", image=img,\n                  taskType=\"INPAINTING\", maskPrompt=\"sky\",\n                  prompt=\"fill with blue sky\")","handlingStrategy":"validation","validationCode":"def validate_prompt_for_task(prompt: str | None, task_type: str | None) -> None:\n    if task_type in (\"INPAINTING\", \"OUTPAINTING\") and (prompt is None or prompt == \"\"):\n        raise ValueError(f\"{task_type} requires a non-empty prompt\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["bedrock","nova-canvas","image-edit","validation","prompt"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}