{"record":{"id":"423a53881756b931","repo":"sgl-project/sglang","slug":"multimodal-data-is-corrupted-or-cannot-be-decoded","errorCode":null,"errorMessage":"Multimodal data is corrupted or cannot be decoded: {e}","messagePattern":"Multimodal data is corrupted or cannot be decoded: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/mimo_v2.py","lineNumber":2009,"sourceCode":"                            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:\n            input_sample = await loop.run_in_executor(\n                self.io_executor,\n                lambda: self.mimo_processor.process(contents, verbose=False),\n            )\n        except RuntimeError as e:\n            logger.error(f\"MiMo processor failed in process_mm_data_async: {e}\")\n            raise ValueError(f\"Multimodal data is corrupted or cannot be decoded: {e}\")\n\n        input_ids = input_sample.input_ids.flatten()\n        mm_items: list[MultimodalDataItem] = []\n        if len(input_sample.image_thw_grids) > 0:\n            mm_items.append(\n                MultimodalDataItem(\n                    modality=Modality.IMAGE,\n                    feature=torch.cat(\n                        [v.cpu() for v in input_sample.pixel_values], dim=0\n                    ),\n                    model_specific_data={\n                        \"image_grid_thw\": torch.stack(input_sample.image_thw_grids)\n                    },\n                    offsets=self.get_mm_items_offset(\n                        input_ids=input_ids,\n                        mm_token_id=self.mimo_processor.image_token_id,\n                    ),\n                )","sourceCodeStart":1991,"sourceCodeEnd":2027,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/mimo_v2.py#L1991-L2027","documentation":"The top-level ValueError raised by process_mm_data_async when the underlying MiMoProcessor.process call fails with a RuntimeError inside the IO executor. It aggregates any lower-level multimodal processing failure (video/image/audio decode or transform errors) into one 'corrupted or cannot be decoded' message with the cause chained.","triggerScenarios":"Any exception escaping mimo_processor.process during a multimodal request — typically the wrapped video failures (5786), image loading failures (5790), or transform errors (5789) surfacing as this ValueError at the API boundary.","commonSituations":"Users see this message instead of the specific cause; the actual error is in the server log line 'MiMo processor failed in process_mm_data_async' and in the {e} detail. Common with mixed-content requests where one item is bad.","solutions":["Read the {e} detail and the server log to find the true underlying error (video/image/audio specific) and fix that","Pre-validate each multimodal item (openable/decodable) client-side before sending the request","For batches, split the request to isolate the failing item"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# pre-flight: open every image, ffprobe every video, decode every audio before sending\nfor im in images: PIL.Image.open(BytesIO(im)).verify()\nfor v in videos: assert subprocess.run(['ffprobe','-v','error',v]).returncode == 0\nfor a in audios: assert isinstance(a, (str, bytes))","typeGuard":null,"tryCatchPattern":"try:\n    sample = await processor.process_mm_data_async(text, images=images, videos=videos, audios=audios)\nexcept ValueError as e:\n    if 'corrupted or cannot be decoded' in str(e):\n        logger.error('underlying cause: %s', e)  # detail carries the real error\n        return error_response(400, 'one or more attachments failed to decode')\n    raise","preventionTips":["Pre-validate every attachment client-side","Split large multimodal requests to isolate bad items","Always check server logs for 'MiMo processor failed' to get the root cause"],"tags":["multimodal","wrapper","decode","request"],"backgroundTag":"media-decode-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}