{"record":{"id":"7217b7141bb58143","repo":"sgl-project/sglang","slug":"unsupported-audio-item-loaded-loaded-type-raw","errorCode":null,"errorMessage":"unsupported audio item: loaded={loaded_type}, raw={raw_type}","messagePattern":"unsupported audio item: loaded=(.+?), raw=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/mimo_v2.py","lineNumber":1984,"sourceCode":"                        self._make_video_content(\n                            video_tuple,\n                            use_audio,\n                            raw_video_item_audio,\n                            preprocess_kwargs,\n                        )\n                    )\n                elif modality == Modality.AUDIO:\n                    loaded_audio = next(loaded_audio_iter)\n                    raw_audio_item = next(raw_audio_iter)\n\n                    if isinstance(loaded_audio, np.ndarray):\n                        audio_source = loaded_audio\n                    elif isinstance(raw_audio_item, dict):\n                        audio_source = raw_audio_item.get(\"url\", loaded_audio)\n                    elif isinstance(raw_audio_item, (str, bytes, torch.Tensor)):\n                        audio_source = raw_audio_item\n                    else:\n                        raise ValueError(\n                            f\"unsupported audio item: loaded={type(loaded_audio).__name__}, \"\n                            f\"raw={type(raw_audio_item).__name__}\"\n                        )\n\n                    contents.append(\n                        Content(\n                            type=\"audio\",\n                            content=AudioInput(\n                                audio=audio_source,\n                            ),\n                        )\n                    )\n            else:\n                if text_part:\n                    contents.append(Content(type=\"text\", content=text_part))\n\n        loop = asyncio.get_running_loop()\n        try:","sourceCodeStart":1966,"sourceCodeEnd":2002,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/mimo_v2.py#L1966-L2002","documentation":"Raised in process_mm_data_async when an audio item's loaded value and raw value match none of the accepted shapes: raw not a dict with 'url', not str/bytes/torch.Tensor, after the loaded-type branches also failed. The message reports both the loaded and raw types for diagnosis.","triggerScenarios":"Sending an audios=[...] entry that is, e.g., a list of chunks, a dict without 'url' (like {'path': ...} or {'base64': ...}), a numpy array, or None, where the loaded form also isn't a handled type.","commonSituations":"Client schema drift (using 'path' or 'data' keys instead of 'url'); sending audio as numpy float arrays; None entries from upstream parsing; version mismatches in the audio request format.","solutions":["Send audio as a URL string, raw bytes, or a torch.Tensor waveform","If using a dict, use exactly {'url': ...}","Check the loaded={...} raw={...} types in the message to see which entry is malformed"],"exampleFix":"# before\naudio = {'path': '/tmp/a.wav'}          # unsupported key\n# after\naudio = {'url': 'https://example.com/a.wav'}\n# or: audio = open('/tmp/a.wav','rb').read()","handlingStrategy":"type-guard","validationCode":"import torch\ndef is_supported_audio(a) -> bool:\n    return isinstance(a, (str, bytes, torch.Tensor)) or (isinstance(a, dict) and isinstance(a.get('url'), str))","typeGuard":"from typing import Union, TypeGuard\nimport torch\ndef is_supported_audio_item(a) -> TypeGuard[Union[str, bytes, torch.Tensor, dict]]:\n    return isinstance(a, (str, bytes, torch.Tensor)) or \\\n           (isinstance(a, dict) and isinstance(a.get('url'), str))","tryCatchPattern":"try:\n    out = await epd.process_mm_data_async(text, audios=audios)\nexcept ValueError as e:\n    if 'unsupported audio item' in str(e):\n        audios = [a['url'] if isinstance(a, dict) else a for a in audios]  # normalize, retry\n        out = await epd.process_mm_data_async(text, audios=audios)\n    else:\n        raise","preventionTips":["Send audio as URL/bytes/Tensor only; dicts must use the 'url' key","Schema-validate audios arrays client-side","Filter out None entries before submit"],"tags":["audio","input-validation","type-error","multimodal"],"backgroundTag":"unsupported-input-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}