{"record":{"id":"456f7194d9f7c256","repo":"calesthio/OpenMontage","slug":"prompt-is-required","errorCode":null,"errorMessage":"prompt is required","messagePattern":"prompt is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/graphics/kling_official_image.py","lineNumber":396,"sourceCode":"            client.download(url, output_path)\n            paths.append(output_path)\n        return paths\n\n    @staticmethod\n    def _output_url(item: dict[str, Any]) -> str:\n        url = item.get(\"url\") or item.get(\"image_url\") or item.get(\"resource_url\")\n        if url:\n            return str(url)\n        resource = item.get(\"resource\") or {}\n        if isinstance(resource, dict) and resource.get(\"url\"):\n            return str(resource[\"url\"])\n        raise ValueError(f\"Kling image response item contained no downloadable URL: {item}\")\n\n    @staticmethod\n    def _prompt(inputs: dict[str, Any]) -> str:\n        prompt = str(inputs.get(\"prompt\") or \"\").strip()\n        if not prompt:\n            raise ValueError(\"prompt is required\")\n        return prompt\n\n    @staticmethod\n    def _copy_common_task_fields(inputs: dict[str, Any], payload: dict[str, Any]) -> None:\n        if \"watermark\" in inputs:\n            payload[\"watermark_info\"] = {\"enabled\": bool(inputs.get(\"watermark\"))}\n        callback_url = validate_callback_url(inputs.get(\"callback_url\"))\n        if callback_url:\n            payload[\"callback_url\"] = callback_url\n        if inputs.get(\"external_task_id\"):\n            payload[\"external_task_id\"] = inputs[\"external_task_id\"]\n\n    @staticmethod\n    def _reference_metadata_from_generation_payload(payload: dict[str, Any]) -> list[dict[str, Any]]:\n        references: list[dict[str, Any]] = []\n        if payload.get(\"image\"):\n            references.append({\"kind\": \"image\", \"source_type\": \"image\"})\n        if payload.get(\"element_list\"):","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/kling_official_image.py#L378-L414","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\ninputs = {\"image\": \"ref.png\"}\n# after\ninputs = {\"image\": \"ref.png\", \"prompt\": \"cinematic portrait, soft rim light\"}","handlingStrategy":"validation","validationCode":"prompt = str(inputs.get(\"prompt\") or \"\").strip()\nif not prompt:\n    raise ValueError(\"prompt required before kling_official_image\")\ninputs[\"prompt\"] = prompt","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["kling","image-generation","input-validation","prompt"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}