{"record":{"id":"9d24dc9c4d084a6f","repo":"sgl-project/sglang","slug":"unsupported-video-input-type-for-epd-encoder-typ","errorCode":null,"errorMessage":"Unsupported video input type for EPD encoder: {type(video_data)}","messagePattern":"Unsupported video input type for EPD encoder: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/mimo_v2.py","lineNumber":528,"sourceCode":"            AudioDecoder(source)\n            return True\n        except Exception:\n            return False\n\n    def _load_video_for_encoder(self, video_data):\n        # Normalise once to bytes-or-path; reused by frame decode, audio\n        # detection, and audio preprocessing without re-downloading.\n        from sglang.srt.utils.common import VideoData, _normalize_video_input\n        from sglang.srt.utils.video_decoder import VideoDecoderWrapper\n\n        if isinstance(video_data, VideoData):\n            video_data = video_data.url\n        if isinstance(video_data, bytes):\n            video_blob = video_data\n        else:\n            video_blob = _normalize_video_input(video_data)\n            if video_blob is None:\n                raise ValueError(\n                    f\"Unsupported video input type for EPD encoder: {type(video_data)}\"\n                )\n\n        vdw = VideoDecoderWrapper(\n            video_blob,\n            device=\"cpu\",\n            num_decode_threads=self.video_decode_num_threads,\n        )\n        try:\n            video_tuple = _decode_frames_and_timestamps(\n                vdw, self.default_video_processor_kwargs\n            )\n        finally:\n            if hasattr(vdw, \"close\"):\n                vdw.close()\n        return video_blob, video_tuple\n\n    def preprocess_for_encoder(self, mm_data, modality):","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/mimo_v2.py#L510-L546","documentation":"Raised in _load_video_for_encoder when _normalize_video_input(video_data) returns None, meaning the video input object is not one of the supported types (URL string, bytes, file-like). The f-string reports the concrete Python type so you can see exactly what was passed.","triggerScenarios":"Passing a video element whose resolved value is neither video_data.url, bytes, nor a type _normalize_video_input understands — e.g. a dict without a url key, a pathlib.Path, None, or an arbitrary object — to a MiMo-V2 EPD encoder request.","commonSituations":"Clients sending {'type':'video','video':{'path':...}} instead of {'video': {'url': ...}}; passing a local filesystem path object where only URL/bytes are supported; schema drift between client and server versions.","solutions":["Pass the video as an http(s) URL string or raw bytes in the request","If using a dict, ensure it exposes the expected 'url' field so video_data = video_data.url resolves","Check the type logged in the message and convert the input (read file to bytes, or expose a URL) before sending"],"exampleFix":"# before\nvideo = {'type': 'video', 'video': pathlib.Path('clip.mp4')}\n# after\nvideo = {'type': 'video', 'video': {'url': 'https://example.com/clip.mp4'}}\n# or: video = {'type': 'video', 'video': open('clip.mp4','rb').read()}","handlingStrategy":"type-guard","validationCode":"def is_supported_video(v) -> bool:\n    if isinstance(v, dict):\n        return isinstance(v.get('url'), str)\n    return isinstance(v, (str, bytes))","typeGuard":"from typing import Union\ndef is_supported_video_input(v) -> TypeGuard[Union[str, bytes, dict]]:\n    return isinstance(v, (str, bytes)) or (isinstance(v, dict) and isinstance(v.get('url'), str))","tryCatchPattern":"try:\n    out = proc.preprocess_for_encoder(video_input)\nexcept ValueError as e:\n    if 'Unsupported video input type' in str(e):\n        return error_response(400, f'video must be url/bytes; got {type(video_input)}')\n    raise","preventionTips":["Standardize on {'url': ...} dicts for video attachments","Reject None/Path/numpy inputs in the client schema before submit","Log the offending type whenever forwarding raw user payloads"],"tags":["video","input-validation","type-error","multimodal"],"backgroundTag":"unsupported-input-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}