{"record":{"id":"e05fa5e75cc16ea5","repo":"sgl-project/sglang","slug":"video-block-token-counts-and-timestamps-must-align","errorCode":null,"errorMessage":"video block token counts and timestamps must align","messagePattern":"video block token counts and timestamps must align","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py","lineNumber":259,"sourceCode":"    content tokens; vision delimiters remain dense.\n    \"\"\"\n    if not prompt:\n        raise ValueError(\"prompt must be non-empty\")\n    presentation = _Presentation(track_video_mask=return_video_mask)\n    video_token_id = (\n        tokenizer.convert_tokens_to_ids(VIDEO_PAD) if return_video_mask else None\n    )\n    image_token_counts = _as_int_list(image_token_count, name=\"image_token_count\")\n    video_counts_by_ref = _as_nested_int_list(\n        video_block_token_counts,\n        name=\"video_block_token_counts\",\n    )\n    video_timestamps_by_ref = _as_nested_float_list(\n        video_block_timestamps,\n        name=\"video_block_timestamps\",\n    )\n    if len(video_counts_by_ref) != len(video_timestamps_by_ref):\n        raise ValueError(\"video block token counts and timestamps must align\")\n    image_seen = 0\n    video_seen = 0\n    for cond_type, ordinal in condition_labels:\n        if cond_type == \"image\":\n            image_seen += 1\n            if image_seen > len(image_token_counts):\n                raise ValueError(\"image_token_count required for an image reference\")\n            count = int(image_token_counts[image_seen - 1])\n            if count <= 0:\n                raise ValueError(\"image_token_count required for an image reference\")\n            presentation.text(_text_ids(tokenizer, f\"<Picture {ordinal}>: \"))\n            presentation.vision(_vision_block_ids(tokenizer, IMAGE_PAD, count))\n        elif cond_type == \"audio\":\n            presentation.text(_text_ids(tokenizer, f\"<Audio {ordinal}>: \"))\n        elif cond_type == \"video\":\n            video_seen += 1\n            if video_seen > len(video_counts_by_ref):\n                raise ValueError(","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py#L241-L277","documentation":"After normalization, the number of video references implied by video_block_token_counts must equal the number implied by video_block_timestamps; each video reference needs both counts and timestamps.","triggerScenarios":"Passing counts for 2 videos but timestamps for 1, e.g. counts=[[196],[196]] with timestamps=[[3.5]]. This typically results from inconsistent flat/nested nesting between the two arguments.","commonSituations":"Building the two lists in different code paths; one argument flat for a single video while the other is nested (flat counts=[[196]] equivalent vs nested timestamps with extra/missing group).","solutions":["Make both arguments use identical nesting and the same number of per-reference groups","Generate counts and timestamps together as paired per-video records","Add a pre-call check len(normalized_counts) == len(normalized_timestamps)"],"exampleFix":"// before\nvideo_block_token_counts=[196,196],\nvideo_block_timestamps=[[3.5],[7.0]],\n// after\nvideo_block_token_counts=[[196,196]],\nvideo_block_timestamps=[[3.5,7.0]],","handlingStrategy":"validation","validationCode":"if len(video_block_token_counts) != len(video_block_timestamps):\n    raise ValueError(\"one counts group and one timestamps group per video\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use identical nesting for both arguments","Generate them as paired per-video records"],"tags":["minimax-h3","ref2va","alignment"],"backgroundTag":"length-mismatch-validation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}