{"record":{"id":"99d7a89c8e419594","repo":"sgl-project/sglang","slug":"no-frames-decoded-from-video-video-path-r","errorCode":null,"errorMessage":"No frames decoded from video: {video_path!r}","messagePattern":"No frames decoded from video: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py","lineNumber":201,"sourceCode":"            )\n            if not image_sources:\n                raise ValueError(\"Cosmos3 I2V image list is empty\")\n            tensors: list[torch.Tensor] = []\n            for src in image_sources:\n                image = load_image(src)\n                image = _resize_crop_pil(image, target_w, target_h)\n                tensors.append(_pil_to_normalized_tensor(image))\n            batch.preprocessed_image = torch.stack(tensors, dim=0).contiguous()\n            self.log_info(\n                f\"Preprocessed {len(tensors)} conditioning image(s) to \"\n                f\"{target_w}x{target_h}\"\n            )\n            return batch\n\n        if isinstance(video_path, str) and video_path:\n            frames = load_video(video_path)\n            if not frames:\n                raise ValueError(f\"No frames decoded from video: {video_path!r}\")\n\n            keep = (\n                getattr(batch.sampling_params, \"condition_video_keep\", \"first\")\n                or \"first\"\n            )\n            if keep not in (\"first\", \"last\"):\n                raise ValueError(\n                    f\"condition_video_keep must be 'first' or 'last', got {keep!r}\"\n                )\n            cond_indexes = self._resolve_condition_indexes(batch)\n            # Encode the full output-length video so that the latent positions\n            # we lock match what the decoder will reconstruct at those frame\n            # indices. Encoding only the first ``max_idx*4+1`` frames produces\n            # an out-of-distribution latent for the locked slots and decodes\n            # to noise.\n            num_source_frames = max(cond_indexes) * 4 + 1\n            num_target_frames = batch.num_frames\n            if keep == \"last\":","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py#L183-L219","documentation":"For V2V requests, Cosmos3 decodes the conditioning video with load_video; if decoding yields zero frames (corrupt file, unsupported codec, unreadable path), the stage cannot build condition latents and raises with the offending path.","triggerScenarios":"video_path is a non-empty string but load_video(video_path) returns an empty list — corrupt/truncated video, wrong container/codec, missing ffmpeg/dec support, or a URL/path the loader can't open.","commonSituations":"Downloading a partially-written mp4; feeding .avi/.webm the decode stack doesn't support; containerized deployment without ffmpeg; wrong mount path so the file is empty.","solutions":["Verify the file plays locally and inspect it (ffprobe video.mp4) — confirm codec/container support and nonzero duration","Re-download or re-encode the video (ffmpeg -i in.mp4 -c:v libx264 out.mp4)","Check the path/URL is readable from the server process and ffmpeg is installed","Add a pre-upload probe in your client that rejects videos with 0 frames"],"exampleFix":"# before\nreq = {\"video_path\": \"corrupt.mp4\", \"prompt\": \"...\"}\n# after\n# re-encode to a supported codec first\n# ffmpeg -i corrupt.mp4 -c:v libx264 -pix_fmt yuv420p fixed.mp4\nreq = {\"video_path\": \"fixed.mp4\", \"prompt\": \"...\"}","handlingStrategy":"validation","validationCode":"import decord, os\nassert os.path.exists(video_path) and os.path.getsize(video_path) > 0\nvr = decord.VideoReader(video_path)\nassert len(vr) > 0, \"video has no frames\"","typeGuard":null,"tryCatchPattern":"catch ValueError matching 'No frames decoded' and route the item to a re-encode/reject path instead of retrying","preventionTips":["Probe videos with ffprobe before submission","Ensure ffmpeg/decord are installed in the serving image"],"tags":["cosmos3","v2v","video-decode","ffmpeg","corrupt-file"],"backgroundTag":"video-decode-no-frames","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}