sgl-project/sglang · error · ValueError
Unsupported video input type for EPD encoder: {type(video_da
Error message
Unsupported video input type for EPD encoder: {type(video_data)} What it means
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.
Source
Thrown at python/sglang/srt/multimodal/processors/mimo_v2.py:528
AudioDecoder(source)
return True
except Exception:
return False
def _load_video_for_encoder(self, video_data):
# Normalise once to bytes-or-path; reused by frame decode, audio
# detection, and audio preprocessing without re-downloading.
from sglang.srt.utils.common import VideoData, _normalize_video_input
from sglang.srt.utils.video_decoder import VideoDecoderWrapper
if isinstance(video_data, VideoData):
video_data = video_data.url
if isinstance(video_data, bytes):
video_blob = video_data
else:
video_blob = _normalize_video_input(video_data)
if video_blob is None:
raise ValueError(
f"Unsupported video input type for EPD encoder: {type(video_data)}"
)
vdw = VideoDecoderWrapper(
video_blob,
device="cpu",
num_decode_threads=self.video_decode_num_threads,
)
try:
video_tuple = _decode_frames_and_timestamps(
vdw, self.default_video_processor_kwargs
)
finally:
if hasattr(vdw, "close"):
vdw.close()
return video_blob, video_tuple
def preprocess_for_encoder(self, mm_data, modality):View on GitHub (pinned to 0132848349)
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
Example fix
# before
video = {'type': 'video', 'video': pathlib.Path('clip.mp4')}
# after
video = {'type': 'video', 'video': {'url': 'https://example.com/clip.mp4'}}
# or: video = {'type': 'video', 'video': open('clip.mp4','rb').read()} Defensive patterns
Strategy: type-guard
Validate before calling
def is_supported_video(v) -> bool:
if isinstance(v, dict):
return isinstance(v.get('url'), str)
return isinstance(v, (str, bytes)) Type guard
from typing import Union
def is_supported_video_input(v) -> TypeGuard[Union[str, bytes, dict]]:
return isinstance(v, (str, bytes)) or (isinstance(v, dict) and isinstance(v.get('url'), str)) Try / catch
try:
out = proc.preprocess_for_encoder(video_input)
except ValueError as e:
if 'Unsupported video input type' in str(e):
return error_response(400, f'video must be url/bytes; got {type(video_input)}')
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported image type: {type(image)}
- Expected a PIL image, got {type(image)}
- unsupported audio item: loaded={loaded_type}, raw={raw_type}
- Unsupported video input type: {type(video_file)}
- When using multiple prompts with multiple input images, prov
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/9d24dc9c4d084a6f.
Report an issue: GitHub.