{"record":{"id":"a76b0cb88fcfe0c6","repo":"sgl-project/sglang","slug":"failed-to-generate-video-str-e","errorCode":null,"errorMessage":"Failed to generate video: {str(e)}","messagePattern":"Failed to generate video: (.+?)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py","lineNumber":358,"sourceCode":"                        raise RuntimeError(\n                            f\"Lost connection to server after {consecutive_errors} consecutive errors. \"\n                            f\"Server may be unavailable: {str(e)}\"\n                        )\n                except requests.exceptions.RequestException as e:\n                    # Other network errors - continue polling but track errors\n                    consecutive_errors += 1\n                    if consecutive_errors >= max_consecutive_errors:\n                        raise RuntimeError(\n                            f\"Network error after {consecutive_errors} consecutive failures: {str(e)}\"\n                        )\n\n                time.sleep(poll_interval)\n\n            raise TimeoutError(\n                f\"Video generation timed out after {max_wait_time} seconds\"\n            )\n        except requests.exceptions.RequestException as e:\n            raise RuntimeError(f\"Failed to generate video: {str(e)}\")\n\n    def _build_image_common_params(\n        self,\n        prompt: str,\n        size: str,\n        n: int,\n        response_format: str,\n        negative_prompt: Optional[str] = None,\n        guidance_scale: Optional[float] = None,\n        num_inference_steps: Optional[int] = None,\n        seed: Optional[int] = None,\n        enable_teacache: bool = False,\n        background: Optional[str] = None,\n        output_format: Optional[str] = None,\n        generator_device: Optional[str] = None,\n    ) -> Dict[str, Any]:\n        \"\"\"\n        Build common parameters for both image generation and editing.","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/server_api.py#L340-L376","documentation":"RuntimeError wrapper raised by generate_video for requests exceptions that escape the polling loop's specific handlers — typically the initial job-submission POST failing, or a RequestException not caught by the ConnectionError/timeout branches.","triggerScenarios":"The initial generate request to the server fails (server down, 4xx/5xx on submit, connection refused) before polling ever starts.","commonSituations":"Server not started; wrong base_url; auth failure on the video endpoint; submit request timing out.","solutions":["Verify the server is reachable and the video endpoint exists (curl base_url).","Check the embedded message for status codes: fix api_key/paths accordingly.","Retry after the server is fully loaded; video endpoints may register late.","Inspect server logs during submit."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import requests\nrequests.post(f\"{base_url}/video/generate\", json={'prompt':'ping'}, headers=headers, timeout=10)","typeGuard":null,"tryCatchPattern":"try:\n    job = api.generate_video(prompt=p)\nexcept RuntimeError as e:\n    if 'ConnectionError' in str(e) or 'refused' in str(e):\n        wait_for_server(); job = api.generate_video(prompt=p)\n    else: raise","preventionTips":["Confirm video endpoints exist on the deployed server version.","Health-check before the first submit.","Retry submit once with backoff; poll errors have their own handlers."],"tags":["network","http","video-generation","submit","sgldiffusion"],"backgroundTag":"http-request-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}