{"record":{"id":"274fd5170c8b4f8c","repo":"sgl-project/sglang","slug":"unsupported-audio-item-loaded-loaded-type-raw-274fd5","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_asr.py","lineNumber":236,"sourceCode":"        contents: List[_Content] = []\n\n        for text_part in text_parts:\n            if multimodal_tokens_pattern.match(text_part):\n                modality = self.mm_tokens.get_modality_of_token(text_part)\n                assert modality is not None\n\n                if 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(audio=audio_source),\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:\n            input_ids, audio_inputs, position_ids, rope_deltas = (\n                await loop.run_in_executor(","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/mimo_v2_asr.py#L218-L254","documentation":"MiMo-v2 ASR processor rejects an audio item whose loaded value and raw value are both of unrecognized types. The loader failed to produce a usable object and the raw user-supplied item is not a dict, str, bytes, or torch.Tensor, so the processor has no way to fetch or decode the audio.","triggerScenarios":"Calling process_mm_data_async (i.e. sending an Audio request) with an audio element that is e.g. an int, None, a PIL object, or a custom class; also when the loader returns a non-standard type and the raw item is not one of the four accepted types.","commonSituations":"Passing a file path as Path instead of str, passing None for a failed URL fetch, serializing audio through a client that converts it to an unsupported type, or version changes in the loading layer returning new object types.","solutions":["Convert the audio item to a plain str URL, bytes, torch.Tensor, or a dict with a 'url' key before sending it","If using pathlib.Path, wrap it with str(path)","Check that the audio URL is reachable and loads correctly (a failed load leaves loaded_audio in an unusable state)","Upgrade sglang if the loader in your version returns an unsupported type for your audio format"],"exampleFix":"// before\n{\"type\":\"audio\",\"audio\": Path(\"/data/speech.wav\")}\n// after\n{\"type\":\"audio\",\"audio\": \"/data/speech.wav\"}","handlingStrategy":"type-guard","validationCode":"def is_supported_audio(item) -> bool:\n    return item is None or isinstance(item, (str, bytes, torch.Tensor)) or (isinstance(item, dict) and \"url\" in item)","typeGuard":"import torch\ndef is_supported_audio(item: object) -> bool:\n    if isinstance(item, (str, bytes, torch.Tensor)):\n        return True\n    return isinstance(item, dict) and isinstance(item.get(\"url\"), str)","tryCatchPattern":"try:\n    resp = client.process(audio_item)\nexcept ValueError as e:\n    if \"unsupported audio item\" in str(e):\n        raise TypeError(f\"Bad audio payload: {audio_item!r}\") from e\n    raise","preventionTips":["Always send audio as a str URL, bytes, torch.Tensor, or {'url': ...}","Convert Path to str before serialization","Validate payloads against supported types in client wrappers"],"tags":["multimodal","audio","type-validation","asr"],"backgroundTag":"unsupported-input-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}