{"record":{"id":"a538c39a6ac963b2","repo":"sgl-project/sglang","slug":"unused-image-token-count-entries","errorCode":null,"errorMessage":"unused image_token_count entries","messagePattern":"unused image_token_count entries","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":298,"sourceCode":"            counts = video_counts_by_ref[video_seen - 1]\n            timestamps = video_timestamps_by_ref[video_seen - 1]\n            if not counts or not timestamps:\n                raise ValueError(\n                    \"video reference requires block token counts and timestamps\"\n                )\n            presentation.text(_text_ids(tokenizer, f\"<Video {ordinal}>: \"))\n            _timestamped_video_blocks(\n                presentation,\n                tokenizer,\n                counts=counts,\n                timestamps=timestamps,\n                context=\"\",\n                video_token_id=video_token_id,\n            )\n        else:\n            raise ValueError(f\"unsupported ref2va condition type {cond_type!r}\")\n    if image_seen != len(image_token_counts):\n        raise ValueError(\"unused image_token_count entries\")\n    if video_seen != len(video_counts_by_ref):\n        raise ValueError(\"unused video block token count entries\")\n    presentation.text(_text_ids(tokenizer, prompt))\n    return presentation.build(return_video_mask=return_video_mask)\n\n\n__all__ = [\n    \"minimax_h3_multi_image_presentation\",\n    \"minimax_h3_ref2va_presentation\",\n    \"minimax_h3_ref2va_video_presentation\",\n    \"minimax_h3_text_only_ids\",\n]\n","sourceCodeStart":280,"sourceCodeEnd":311,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py#L280-L311","documentation":"After processing all condition_labels, extra image_token_count entries remain — more counts were supplied than there are image references in the plan, indicating a mismatch between conditioning data and the plan.","triggerScenarios":"image_token_count=[196,196,196] but condition_labels has only 2 image entries.","commonSituations":"Reusing a multi-image counts list with a plan that dropped an image; stale counts after editing the plan; off-by-one when building lists.","solutions":["Trim image_token_count to the number of image references in condition_labels","Update the plan to include the missing image reference","Regenerate both from one source of truth"],"exampleFix":"// before\nimage_token_count=[196,196,196], 2 image refs in plan\n// after\nimage_token_count=[196,196], 2 image refs in plan","handlingStrategy":"validation","validationCode":"n_images = sum(1 for t, _ in condition_labels if t == \"image\")\nassert len(image_token_counts_list) == n_images","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate plan and counts together","Trim stale entries after plan edits"],"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"}