calesthio/OpenMontage · error · ValueError
prompt is required
Error message
prompt is required
What it means
Raised by KlingOfficialImage._prompt when the 'prompt' input is missing, empty, or whitespace-only after stripping. The Kling image API requires a non-empty text prompt, so the tool refuses before making any network call. This is a pure input-validation error and costs nothing when raised.
Source
Thrown at tools/graphics/kling_official_image.py:396
client.download(url, output_path)
paths.append(output_path)
return paths
@staticmethod
def _output_url(item: dict[str, Any]) -> str:
url = item.get("url") or item.get("image_url") or item.get("resource_url")
if url:
return str(url)
resource = item.get("resource") or {}
if isinstance(resource, dict) and resource.get("url"):
return str(resource["url"])
raise ValueError(f"Kling image response item contained no downloadable URL: {item}")
@staticmethod
def _prompt(inputs: dict[str, Any]) -> str:
prompt = str(inputs.get("prompt") or "").strip()
if not prompt:
raise ValueError("prompt is required")
return prompt
@staticmethod
def _copy_common_task_fields(inputs: dict[str, Any], payload: dict[str, Any]) -> None:
if "watermark" in inputs:
payload["watermark_info"] = {"enabled": bool(inputs.get("watermark"))}
callback_url = validate_callback_url(inputs.get("callback_url"))
if callback_url:
payload["callback_url"] = callback_url
if inputs.get("external_task_id"):
payload["external_task_id"] = inputs["external_task_id"]
@staticmethod
def _reference_metadata_from_generation_payload(payload: dict[str, Any]) -> list[dict[str, Any]]:
references: list[dict[str, Any]] = []
if payload.get("image"):
references.append({"kind": "image", "source_type": "image"})
if payload.get("element_list"):View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Supply a non-empty prompt string (strip check applies)
- If the prompt is composed dynamically, fall back to a default descriptor when composition yields empty text
- Validate inputs before invoking the tool in pipeline code
Example fix
# before
inputs = {"image": "ref.png"}
# after
inputs = {"image": "ref.png", "prompt": "cinematic portrait, soft rim light"} Defensive patterns
Strategy: validation
Validate before calling
prompt = str(inputs.get("prompt") or "").strip()
if not prompt:
raise ValueError("prompt required before kling_official_image")
inputs["prompt"] = prompt Prevention
- Compose prompts with a non-empty default fallback
- Validate prompt presence in pipeline schema before dispatch
- Treat empty upstream fields as pipeline errors at their source
When it happens
Trigger: Calling kling_official_image with prompt omitted, set to '' or ' ', or built from a template variable that resolved to an empty string (e.g. caption/topic pipeline produced no text).
Common situations: Agent pipelines composing prompts from optional upstream fields (subject/scene/style) where all parts were empty; passing only an image reference expecting img2img without prompt because a sibling tool allowed it.
Related errors
- MiniMax image generation requires 'prompt'.
- prompt is required
- prompt references <<<image_{max(existing_numbers)}>>> but on
- Image Omni prompt placeholders must start at <<<image_1>>>
- Kling avatar requires image_url or image_path
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/456f7194d9f7c256.
Report an issue: GitHub.