sgl-project/sglang · error · RuntimeError

Failed to generate video: {str(e)}

Error message

Failed to generate video: {str(e)}

What it means

RuntimeError from the ComfyUI video node wrapping any exception from sgld_client.generate_video or from converting the resulting file — includes submit failures, polling errors, job failures, timeouts, and missing/unreadable video files (convert_video_to_comfy_video).

Source

Thrown at python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py:574

            request_params["enable_teacache"] = True
        if num_frames is not None:
            request_params["num_frames"] = num_frames
        if image is not None:
            # If the image is empty, use the size of the image to generate the video
            if is_empty_image(image):
                width, height = image.shape[2], image.shape[1]
                size = f"{width}x{height}"
                request_params["size"] = size
            else:
                request_params["input_reference"] = get_image_path(image)

        # Call API
        try:
            response = sgld_client.generate_video(**request_params)
            video_path = response.get("file_path", "")
            video = convert_video_to_comfy_video(video_path, height, width)
        except Exception as e:
            raise RuntimeError(f"Failed to generate video: {str(e)}")

        return (video, video_path)


class SGLDiffusionGenerateH3:
    """Node to generate joint video and audio with MiniMax-H3.

    H3 denoises a packed video+audio sequence in one pass and routes its
    conditioning by task rather than by a single reference slot, so it needs
    its own request shape (`task` / `conditions` / `target`) that the generic
    video node does not model. The returned MP4 carries both streams.
    """

    TASKS = ["t2va", "fl2va", "ref2va"]

    @classmethod
    def INPUT_TYPES(cls):
        return {

View on GitHub (pinned to 0132848349)

Solutions

  1. Read the chained message to identify the stage (submit vs poll vs convert).
  2. If it's a convert failure, verify file_path exists on disk and is a valid video.
  3. Fix the underlying generation error per its own guidance (params, timeouts, server health).
  4. Retry with smaller resolution/seconds to shorten the job.

Example fix

// before
response = sgld_client.generate_video(**request_params)
video = convert_video_to_comfy_video(response.get("file_path", ""), height, width)
// after
response = sgld_client.generate_video(**request_params)
video_path = response.get("file_path")
if not video_path or not os.path.isfile(video_path):
    raise RuntimeError(f"server returned invalid file_path: {response!r}")
video = convert_video_to_comfy_video(video_path, height, width)
Defensive patterns

Strategy: try-catch

Validate before calling

import os
# after call: assert os.path.isfile(response.get('file_path', ''))

Type guard

def usable_video_response(r: dict) -> bool:
    p = r.get('file_path')
    return bool(p) and os.path.isfile(p)

Try / catch

try:
    video, path = node.generate_video(...)
except RuntimeError as e:
    msg = str(e)
    if 'timed out' in msg: extend_max_wait_and_retry()
    elif 'invalid file_path' in msg or 'convert' in msg: inspect_output_file()
    else: raise

Prevention

When it happens

Trigger: Any stage of video generation failing inside the node: server down, job error, timeout, or the returned file_path missing/invalid so conversion raises.

Common situations: Server not running; job timed out or errored server-side; file_path empty in response so video loading fails; codec/container issues in the output file.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/86e3d616a6cccf88. Report an issue: GitHub.