{"record":{"id":"fdf88de1e7a4d7bf","repo":"calesthio/OpenMontage","slug":"kling-image-response-contained-no-images","errorCode":null,"errorMessage":"Kling image response contained no images","messagePattern":"Kling image response contained no images","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/graphics/kling_official_image.py","lineNumber":371,"sourceCode":"            if not value:\n                raise ValueError(\"image_list items must include image, image_url, or image_path\")\n            add_image(value, source=source, source_type=\"image_list\")\n        for url in inputs.get(\"image_urls\") or []:\n            add_image(normalize_image_input(url=url), source=url, source_type=\"image_urls\")\n        for path in inputs.get(\"image_paths\") or []:\n            add_image(normalize_image_input(path=path), source=str(path), source_type=\"image_paths\")\n        if inputs.get(\"image_url\") or inputs.get(\"image_path\"):\n            add_image(\n                normalize_image_input(inputs.get(\"image_url\"), inputs.get(\"image_path\")),\n                source=inputs.get(\"image_url\") or inputs.get(\"image_path\"),\n                source_type=\"image\",\n            )\n\n        return image_list, references_used\n\n    def _download_images(self, client: KlingClient, outputs: list[dict[str, Any]], inputs: dict[str, Any]) -> list[Path]:\n        if not outputs:\n            raise ValueError(\"Kling image response contained no images\")\n        base_path = Path(inputs.get(\"output_path\", \"kling_official_image.png\"))\n        paths: list[Path] = []\n        for index, item in enumerate(outputs):\n            url = self._output_url(item)\n            suffix = extension_from_url(url, \".png\")\n            output_path = numbered_output_path(output_path_with_suffix(base_path, suffix), index, suffix)\n            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\"])","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/kling_official_image.py#L353-L389","documentation":"ValueError from _download_images when the Kling API response parses successfully but contains zero image outputs to download. The tool treats an empty outputs list as a contract failure: the generation call 'succeeded' yet produced nothing retrievable.","triggerScenarios":"Kling API returns a success-shaped response with an empty data/images array; content filtering that suppresses outputs without an error status; response schema drift moving images to a different key so the extractor finds none.","commonSituations":"Policy-filtered prompts that return quietly empty results; API updates renaming the images field; partially-successful batch requests where all items were dropped.","solutions":["Inspect the raw Kling response payload (log it at the call site) to see whether images exist under a different key","Rephrase the prompt to avoid likely-filtered content and retry","Verify the model/endpoint combination actually returns synchronous images (some flows return task ids instead)","If the key moved upstream, update _output_url/outputs extraction in kling_official_image.py"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    paths = tool._download_images(client, outputs, inputs)\nexcept ValueError as e:\n    if \"no images\" in str(e):\n        # inspect raw response; empty output is often content filtering or schema drift\n        raise","preventionTips":["Log full Kling responses during development to catch envelope changes","Avoid policy-sensitive prompts in automated pipelines","Confirm the endpoint returns synchronous images, not deferred task ids"],"tags":["kling","image-generation","empty-result","schema"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}