{"record":{"id":"58238f0e33d871ab","repo":"sgl-project/sglang","slug":"unsupported-time-format-time-format-r","errorCode":null,"errorMessage":"unsupported time format: {time_format!r}","messagePattern":"unsupported time format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/dots_note_omni_video_core/video_qa_flattener.py","lineNumber":52,"sourceCode":"        if match:\n            pairs.append((int(match.group(1)), key))\n    return [key for _, key in sorted(pairs)]\n\n\nclass VideoQAFlattener:\n    \"\"\"Apply the frame and audio sampling policy used during training.\"\"\"\n\n    def __init__(\n        self,\n        time_format: str = \"random\",\n        seconds_decimals: int = 1,\n        audio_interleave: bool = False,\n        ai_seg_min_sec: float = 1.0,\n        ai_k_mode: str = \"eval30\",\n        rng: random.Random | None = None,\n    ):\n        if time_format not in (\"hms\", \"seconds\", \"random\"):\n            raise ValueError(f\"unsupported time format: {time_format!r}\")\n        if ai_k_mode not in (\"logk\", \"eval30\", \"eval_ek\", \"whole\"):\n            raise ValueError(f\"unsupported audio interleave mode: {ai_k_mode!r}\")\n\n        self.time_format = time_format\n        self.seconds_decimals = max(0, int(seconds_decimals))\n        self.audio_interleave = bool(audio_interleave)\n        self.ai_seg_min_sec = max(1e-6, float(ai_seg_min_sec))\n        self.ai_k_mode = ai_k_mode\n        self.rng = rng or random.Random()\n\n    def _subsample_one_video(self, video_dict: dict):\n        \"\"\"Return ordered frames, timestamps, and optional WAV data.\"\"\"\n        original_fps = float(video_dict.get(\"fps\", 1.0)) or 1.0\n        image_keys = _sorted_image_keys(video_dict)\n        frames = [video_dict[key] for key in image_keys]\n        timestamps = [round(i / original_fps, 3) for i in range(len(image_keys))]\n        return frames, timestamps, video_dict.get(\"audio_0\") or None\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/dots_note_omni_video_core/video_qa_flattener.py#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nfl = VideoQAFlattener(time_format='sec')\n# after\nfl = VideoQAFlattener(time_format='seconds')","handlingStrategy":"validation","validationCode":"VALID_TF = {'hms','seconds','random'}\nif cfg['time_format'] not in VALID_TF:\n    raise ConfigError(f\"time_format must be one of {VALID_TF}, got {cfg['time_format']!r}\")\nfl = VideoQAFlattener(time_format=cfg['time_format'])","typeGuard":"def is_valid_time_format(v: str) -> bool:\n    return v in ('hms','seconds','random')","tryCatchPattern":null,"preventionTips":["Validate config enums at load time, not at object construction","Use keyword arguments for all flattener options"],"tags":["multimodal","config-validation","video-qa","dots-note-omni"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}