{"record":{"id":"d05e1ed959ae0bd6","repo":"Comfy-Org/ComfyUI","slug":"kling-task-response-data-task-id-succeeded-but-n-d05e1e","errorCode":null,"errorMessage":"Kling task {response.data.task_id} succeeded but no image data found in response.","messagePattern":"Kling task (.+?) succeeded but no image data found in response\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_kling.py","lineNumber":315,"sourceCode":"        error_msg = f\"Kling initial request failed. Code: {response.code}, Message: {response.message}, Data: {response.data}\"\n        logging.error(error_msg)\n        raise Exception(error_msg)\n\n\ndef validate_video_result_response(response) -> None:\n    \"\"\"Validates that the Kling task result contains a video.\"\"\"\n    if not is_valid_video_response(response):\n        error_msg = f\"Kling task {response.data.task_id} succeeded but no video data found in response.\"\n        logging.error(\"Error: %s.\\nResponse: %s\", error_msg, response)\n        raise Exception(error_msg)\n\n\ndef validate_image_result_response(response) -> None:\n    \"\"\"Validates that the Kling task result contains an image.\"\"\"\n    if not is_valid_image_response(response):\n        error_msg = f\"Kling task {response.data.task_id} succeeded but no image data found in response.\"\n        logging.error(\"Error: %s.\\nResponse: %s\", error_msg, response)\n        raise Exception(error_msg)\n\n\ndef validate_input_image(image: torch.Tensor) -> None:\n    \"\"\"\n    Validates the input image adheres to the expectations of the Kling API:\n    - The image resolution should not be less than 300*300px\n    - The aspect ratio of the image should be between 1:2.5 ~ 2.5:1\n\n    See: https://app.klingai.com/global/dev/document-api/apiReference/model/imageToVideo\n    \"\"\"\n    validate_image_dimensions(image, min_width=300, min_height=300)\n    validate_image_aspect_ratio(image, (1, 2.5), (2.5, 1))\n\n\ndef get_video_from_response(response) -> KlingVideoResult:\n    \"\"\"Returns the first video object from the Kling video generation task result.\n    Will raise an error if the response is not valid.\n    \"\"\"","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_kling.py#L297-L333","documentation":"Image-mode counterpart of the video check: raised by validate_image_result_response when a Kling image task succeeded but task_result.images is missing/empty. The task completed yet delivered no image record, which the node treats as a hard failure rather than returning blank output.","triggerScenarios":"Kling image task (e.g. image-to-video first-frame generators or Kling image endpoints) finishing with an empty images array — moderation removal post-completion, storage failure, or payload schema drift.","commonSituations":"Generated image removed by moderation after task success; Kling result CDN issues; rare transient inconsistency on high-load days.","solutions":["Re-run the task with a fresh submission","Take the task_id from the message and inspect it via the Kling console","Soften prompt content in case moderation removed the finished image","Check for comfy_api_nodes updates if the empty result is consistent"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(2):\n    try:\n        out = await kling_image_node(...)\n        break\n    except Exception as e:\n        if attempt == 1 or \"no image data found\" not in str(e):\n            raise","preventionTips":["Re-run the task on this upstream inconsistency","Keep prompts policy-clean so finished images are not removed post-completion","Track task_ids from error messages when reporting to Kling support"],"tags":["kling","image-generation","task-result","upstream-inconsistency"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}