sgl-project/sglang · error · ValueError
video reference requires block token counts and timestamps
Error message
video reference requires block token counts and timestamps
What it means
A video reference appears in condition_labels but there are fewer normalized video_block_token_counts groups than video references — no per-block data exists for this video.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py:277
raise ValueError("video block token counts and timestamps must align")
image_seen = 0
video_seen = 0
for cond_type, ordinal in condition_labels:
if cond_type == "image":
image_seen += 1
if image_seen > len(image_token_counts):
raise ValueError("image_token_count required for an image reference")
count = int(image_token_counts[image_seen - 1])
if count <= 0:
raise ValueError("image_token_count required for an image reference")
presentation.text(_text_ids(tokenizer, f"<Picture {ordinal}>: "))
presentation.vision(_vision_block_ids(tokenizer, IMAGE_PAD, count))
elif cond_type == "audio":
presentation.text(_text_ids(tokenizer, f"<Audio {ordinal}>: "))
elif cond_type == "video":
video_seen += 1
if video_seen > len(video_counts_by_ref):
raise ValueError(
"video reference requires block token counts and timestamps"
)
counts = video_counts_by_ref[video_seen - 1]
timestamps = video_timestamps_by_ref[video_seen - 1]
if not counts or not timestamps:
raise ValueError(
"video reference requires block token counts and timestamps"
)
presentation.text(_text_ids(tokenizer, f"<Video {ordinal}>: "))
_timestamped_video_blocks(
presentation,
tokenizer,
counts=counts,
timestamps=timestamps,
context="",
video_token_id=video_token_id,
)
else:View on GitHub (pinned to 0132848349)
Solutions
- Provide one counts group per video reference: [[...],[...]]
- Trim extra video references from condition_labels
- Regenerate conditioning data from the current plan
Example fix
// before
condition_labels=[("video",1),("video",2)], video_block_token_counts=[196]
// after
condition_labels=[("video",1),("video",2)], video_block_token_counts=[[196],[196]] Defensive patterns
Strategy: validation
Validate before calling
n_videos = sum(1 for t, _ in condition_labels if t == "video") assert len(video_counts_by_ref) >= n_videos
Prevention
- Provide one counts group per video reference
- Use nested form for multi-video plans
When it happens
Trigger: condition_labels=[("video",1),("video",2)] but video_block_token_counts=[[196]] (only one group).
Common situations: Single-video convenience form (flat list) used with a multi-video plan; forgetting per-video groups when the plan has several videos.
Related errors
- {context}video block token counts and timestamps must align
- video block token counts and timestamps must align
- image_token_count required for an image reference
- unused image_token_count entries
- unused video block token count entries
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5f440ea5e271ab4c.
Report an issue: GitHub.