sgl-project/sglang · error · RuntimeError
Video generation failed: {error_msg}
Error message
Video generation failed: {error_msg} What it means
RuntimeError raised inside generate_video's polling loop when the job status endpoint reports a terminal error: the status payload contains an 'error' object whose message is propagated. It means the server accepted the job but generation itself failed server-side.
Source
Thrown at python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py:335
headers=self.headers,
timeout=30,
)
status_response.raise_for_status()
status = status_response.json()
# Reset error counter on successful request
consecutive_errors = 0
if status.get("status") == "completed":
return status
elif status.get("status") == "failed":
error = status.get("error", {})
error_msg = (
error.get("message", "Unknown error")
if error
else "Unknown error"
)
raise RuntimeError(f"Video generation failed: {error_msg}")
except requests.exceptions.ConnectionError as e:
# Connection errors - likely server is down
consecutive_errors += 1
if consecutive_errors >= max_consecutive_errors:
raise RuntimeError(
f"Lost connection to server after {consecutive_errors} consecutive errors. "
f"Server may be unavailable: {str(e)}"
)
except requests.exceptions.RequestException as e:
# Other network errors - continue polling but track errors
consecutive_errors += 1
if consecutive_errors >= max_consecutive_errors:
raise RuntimeError(
f"Network error after {consecutive_errors} consecutive failures: {str(e)}"
)
time.sleep(poll_interval)
View on GitHub (pinned to 0132848349)
Solutions
- Read the embedded error_msg — it comes from the server and names the real cause.
- Fix the reported cause: lower resolution/seconds, free GPU memory, or correct input images.
- Check the SGLang Diffusion server logs for the corresponding stack trace.
- Retry with simpler parameters to confirm the pipeline works.
Defensive patterns
Strategy: try-catch
Validate before calling
# validate video params against model limits before submit assert width % 16 == 0 and height % 16 == 0, 'dimensions must be multiples of 16'
Try / catch
try:
job = api.generate_video(prompt=p)
except RuntimeError as e:
# embedded error_msg names the server-side cause; fix params accordingly
handle_generation_error(str(e)) Prevention
- Keep resolution/seconds within the model's documented envelope.
- Free GPU memory before long video jobs.
- Surface server error_msg to users instead of swallowing it.
When it happens
Trigger: The polled job status returns status=error with an error object — e.g. OOM on the GPU, invalid size/fps/seconds parameters, unsupported video model, or a corrupted input frame image.
Common situations: Requesting resolutions the video model can't handle; VRAM exhaustion with other jobs running; passing reference images in a format the server rejects.
Related errors
- Lost connection to server after {consecutive_errors} consecu
- Network error after {consecutive_errors} consecutive failure
- Video generation timed out after {max_wait_time} seconds
- Failed to generate video: {str(e)}
- Failed to generate MiniMax-H3 video: {str(e)}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/53d7256eaa606faf.
Report an issue: GitHub.