{"record":{"id":"1b957d46d65141f2","repo":"sgl-project/sglang","slug":"no-image-data-in-response-1b957d","errorCode":null,"errorMessage":"No image data in response","messagePattern":"No image data in response","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py","lineNumber":390,"sourceCode":"            request_params[\"enable_teacache\"] = True\n        if image is not None:\n            # If the image is empty, use the size of the image to generate the image\n            if is_empty_image(image):\n                width, height = image.shape[2], image.shape[1]\n                size = f\"{width}x{height}\"\n                request_params[\"size\"] = size\n            else:\n                request_params[\"image_path\"] = get_image_path(image)\n\n        # Call API\n        try:\n            response = sgld_client.generate_image(**request_params)\n        except Exception as e:\n            raise RuntimeError(f\"Failed to generate image: {str(e)}\")\n\n        # Decode base64 image\n        if not response[\"data\"] or not response[\"data\"][0][\"b64_json\"]:\n            raise RuntimeError(\"No image data in response\")\n        image_data = response[\"data\"][0][\"b64_json\"]\n        image = convert_b64_to_tensor_image(image_data)\n\n        return (image,)\n\n\nclass SGLDiffusionGenerateVideo:\n    \"\"\"Node to generate videos using SGLang Diffusion.\"\"\"\n\n    @classmethod\n    def INPUT_TYPES(cls):\n        return {\n            \"required\": {\n                \"sgld_client\": (\"SGLD_CLIENT\",),\n                \"positive_prompt\": (\n                    \"STRING\",\n                    {\n                        \"default\": \"\",","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py#L372-L408","documentation":"RuntimeError from the ComfyUI image node: the API call succeeded but the response's data list is empty or the first image has no b64_json payload, so there is nothing to convert to a tensor.","triggerScenarios":"Server returns 200 with empty data, or data[0] lacking b64_json (e.g. URL-mode response or silent per-image failure).","commonSituations":"Server bug or partial failure; response_format mismatch; requesting more images than the server produced.","solutions":["Log the raw response inside the node to inspect its shape.","If URLs are returned, fetch them instead of expecting b64_json.","Check server logs for why generation yielded no image data.","Retry — occasional transient empty payloads indicate server overload."],"exampleFix":"// before\nif not response[\"data\"] or not response[\"data\"][0][\"b64_json\"]:\n    raise RuntimeError(\"No image data in response\")\n// after\nentry = (response.get(\"data\") or [{}])[0]\nif not entry.get(\"b64_json\"):\n    raise RuntimeError(f\"No image data in response: {response}\")","handlingStrategy":"type-guard","validationCode":"entry = (response.get('data') or [{}])[0]\nassert entry.get('b64_json'), f'unexpected payload: {response}'","typeGuard":"def usable_image_response(r: dict) -> bool:\n    data = r.get('data') or []\n    return bool(data) and bool(data[0].get('b64_json'))","tryCatchPattern":"if not usable_image_response(response):\n    raise RuntimeError(f'No image data in response: {response}')","preventionTips":["Shape-check responses before tensor conversion.","Log raw payloads on schema surprises.","Handle url-style responses as a fallback path."],"tags":["comfyui","empty-response","base64","image-generation"],"backgroundTag":"empty-response-body","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}