{"record":{"id":"701657a9f54109d0","repo":"sgl-project/sglang","slug":"audio-placeholder-count-does-not-match-audio-data","errorCode":null,"errorMessage":"Audio placeholder count does not match audio_data","messagePattern":"Audio placeholder count does not match audio_data","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/dots_note_omni.py","lineNumber":342,"sourceCode":"            rendered.append(input_text[last : match.start()])\n            marker = match.group(0)\n            expanded_media = video_media.get(marker)\n            if expanded_media is not None:\n                modality, value = expanded_media\n            else:\n                modality = self.mm_tokens.get_modality_of_token(marker)\n                if modality == Modality.IMAGE:\n                    try:\n                        value = next(native_images)\n                    except StopIteration as exc:\n                        raise ValueError(\n                            \"Image placeholder count does not match image_data\"\n                        ) from exc\n                elif modality == Modality.AUDIO:\n                    try:\n                        value = next(native_audios)\n                    except StopIteration as exc:\n                        raise ValueError(\n                            \"Audio placeholder count does not match audio_data\"\n                        ) from exc\n                else:\n                    raise ValueError(f\"Unsupported dots omni media marker: {marker}\")\n\n            if modality == Modality.IMAGE:\n                ordered_images.append(value)\n                rendered.append(\n                    self.image_start_token + self.image_token + self.image_end_token\n                )\n            else:\n                ordered_audios.append(value)\n                rendered.append(\n                    self.audio_start_token + self.audio_token + self.audio_end_token\n                )\n            last = match.end()\n\n        rendered.append(input_text[last:])","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/dots_note_omni.py#L324-L360","documentation":"Raised by _merge_video_media when an audio marker is present in the merged prompt but the audio_data iterator is exhausted. Audio placeholders and supplied audio_data must be one-to-one.","triggerScenarios":"Video content or the prompt contains more audio markers (e.g. <|sglang_dots_video_N_audio_M|>) than entries in the request's audio_data list.","commonSituations":"The chat template renders an audio tag per video while the client omits audio_data, or sends fewer audio clips than videos processed with audio enabled (audio_cap > 0).","solutions":["Provide one audio entry per audio marker, or drop audio markers from the prompt/template","Disable audio processing with video_config audio_cap=0 if no audio is being sent","Check for duplicate rendering when multiple videos are flattened into one prompt"],"exampleFix":"// before\nvideo_config = {\"audio_cap\": 1.0}  # renders audio markers\naudio_data = []\n// after\nvideo_config = {\"audio_cap\": 0}  # no audio markers expected\naudio_data = []","handlingStrategy":"validation","validationCode":"audio_markers = count_audio_markers(prompt)  # e.g. regex <|sglang_dots_video_\\d+_audio_\\d+|>\nassert audio_markers == len(audio_data or []), 'audio marker/audio_data mismatch'","typeGuard":null,"tryCatchPattern":"try:\n    await processor.process_mm_data_async(...)\nexcept ValueError as e:\n    if 'Audio placeholder count' in str(e):\n        audio_data = audio_data[:audio_markers] or add markers; retry","preventionTips":["Send one audio clip per audio marker","Set audio_cap=0 when no audio is intended"],"tags":["multimodal","placeholder-mismatch","audio","valueerror"],"backgroundTag":"placeholder-count-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}