{"record":{"id":"64dc4773ed79b06d","repo":"sgl-project/sglang","slug":"failed-to-generate-image-str-e-64dc47","errorCode":null,"errorMessage":"Failed to generate image: {str(e)}","messagePattern":"Failed to generate image: (.+?)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py","lineNumber":386,"sourceCode":"            request_params[\"num_inference_steps\"] = steps\n        if seed is not None and seed >= 0:\n            request_params[\"seed\"] = seed\n        if enable_teacache:\n            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\",),","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py#L368-L404","documentation":"RuntimeError raised by the ComfyUI image node wrapping any exception from sgld_client.generate_image — network failures, server-side errors, or the upstream RuntimeErrors from server_api.py all surface here with their message chained.","triggerScenarios":"Any failure of the underlying API call inside the node: server unreachable, generation error, or decode failure; the node re-raises as 'Failed to generate image: <cause>'.","commonSituations":"Server not running when the workflow executes; model still loading; bad api_key; generation parameters rejected by the server.","solutions":["Read the chained message — it contains the true underlying cause (timeout, status code, etc.).","Start/health-check the SGLang Diffusion server before running the workflow.","Fix the underlying cause per its own error guidance (auth, params, timeout).","Retry the workflow once the server is ready."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import requests\nassert requests.get(f\"{sgld_client.base_url}/models\", timeout=5).ok","typeGuard":null,"tryCatchPattern":"try:\n    out = node.generate_image(...)\nexcept RuntimeError as e:\n    show_in_comfy_ui(str(e))  # chained message holds the real cause\n    raise","preventionTips":["Start and health-check the server before running workflows.","Read chained cause messages before changing code.","Retry once after model load completes."],"tags":["comfyui","image-generation","error-wrapping","network"],"backgroundTag":"http-request-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}