sgl-project/sglang · error · ValueError
unsupported time format: {time_format!r}
Error message
unsupported time format: {time_format!r} What it means
Raised by the constructor of the DotsNote Omni video QA flattener when the time_format argument is not one of the supported values 'hms', 'seconds', or 'random'. This format controls how timestamps are rendered inside flattened QA text (HH:MM:SS vs decimal seconds vs randomly chosen per example). Any other string (including typos or None passed positionally) fails fast before any processing.
Source
Thrown at python/sglang/srt/multimodal/processors/dots_note_omni_video_core/video_qa_flattener.py:52
if match:
pairs.append((int(match.group(1)), key))
return [key for _, key in sorted(pairs)]
class VideoQAFlattener:
"""Apply the frame and audio sampling policy used during training."""
def __init__(
self,
time_format: str = "random",
seconds_decimals: int = 1,
audio_interleave: bool = False,
ai_seg_min_sec: float = 1.0,
ai_k_mode: str = "eval30",
rng: random.Random | None = None,
):
if time_format not in ("hms", "seconds", "random"):
raise ValueError(f"unsupported time format: {time_format!r}")
if ai_k_mode not in ("logk", "eval30", "eval_ek", "whole"):
raise ValueError(f"unsupported audio interleave mode: {ai_k_mode!r}")
self.time_format = time_format
self.seconds_decimals = max(0, int(seconds_decimals))
self.audio_interleave = bool(audio_interleave)
self.ai_seg_min_sec = max(1e-6, float(ai_seg_min_sec))
self.ai_k_mode = ai_k_mode
self.rng = rng or random.Random()
def _subsample_one_video(self, video_dict: dict):
"""Return ordered frames, timestamps, and optional WAV data."""
original_fps = float(video_dict.get("fps", 1.0)) or 1.0
image_keys = _sorted_image_keys(video_dict)
frames = [video_dict[key] for key in image_keys]
timestamps = [round(i / original_fps, 3) for i in range(len(image_keys))]
return frames, timestamps, video_dict.get("audio_0") or None
View on GitHub (pinned to 0132848349)
Solutions
- Set time_format to one of 'hms', 'seconds', or 'random'
- If loading from config, validate/normalize the value before constructing the flattener
- Add the new format to the tuple check if you genuinely need a custom renderer
Example fix
# before fl = VideoQAFlattener(time_format='sec') # after fl = VideoQAFlattener(time_format='seconds')
Defensive patterns
Strategy: validation
Validate before calling
VALID_TF = {'hms','seconds','random'}
if cfg['time_format'] not in VALID_TF:
raise ConfigError(f"time_format must be one of {VALID_TF}, got {cfg['time_format']!r}")
fl = VideoQAFlattener(time_format=cfg['time_format']) Type guard
def is_valid_time_format(v: str) -> bool:
return v in ('hms','seconds','random') Prevention
- Validate config enums at load time, not at object construction
- Use keyword arguments for all flattener options
When it happens
Trigger: Constructing VideoQAFlattener (or a wrapper config) with time_format='sec', 's', 'HHMMSS', or None; passing configuration loaded from YAML/JSON where the key is misspelled or missing and an invalid default leaks through.
Common situations: Copy-pasting config between projects with different format names; CLI argument plumbing where the flag value isn't validated upstream; upgrading when the accepted enum set changed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- unsupported audio interleave mode: {ai_k_mode!r}
- Attention backend '{selected_backend}' is not supported by t
- Unknown image_vae_encoding_position: {image_vae_encoding_pos
- memory_position_mode must be one of {'reference', 'legacy',
- projection_cls = {projection_cls}, not implemented
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/58238f0e33d871ab.
Report an issue: GitHub.