{"record":{"id":"4c7697e94a50474d","repo":"agentscope-ai/agentscope","slug":"unsupported-media-type-media-type-r-in-datablock","errorCode":null,"errorMessage":"Unsupported media type {media_type!r} in DataBlock. Expected image/* or video/*.","messagePattern":"Unsupported media type (.+?) in DataBlock\\. Expected image/\\* or video/\\*\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/embedding/_dashscope/_model.py","lineNumber":526,"sourceCode":"        media_type = source.media_type\n\n        if media_type.startswith(\"video/\"):\n            if not isinstance(source, URLSource):\n                raise ValueError(\n                    \"Multimodal embedding API only supports URL input \"\n                    f\"for video data, got {type(source).__name__}.\",\n                )\n            return {\"video\": str(source.url)}\n\n        if media_type.startswith(\"image/\"):\n            if isinstance(source, Base64Source):\n                return {\n                    \"image\": f\"data:{media_type};\" f\"base64,{source.data}\",\n                }\n            if isinstance(source, URLSource):\n                return {\"image\": str(source.url)}\n\n        raise ValueError(\n            f\"Unsupported media type {media_type!r} in DataBlock. \"\n            f\"Expected image/* or video/*.\",\n        )\n","sourceCodeStart":508,"sourceCodeEnd":530,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/embedding/_dashscope/_model.py#L508-L530","documentation":"_format_data_block only knows how to map image/* (base64 or URL) and video/* (URL) media types to DashScope's multimodal format; any other media_type in a DataBlock raises ValueError listing the unsupported type.","triggerScenarios":"Passing a DataBlock whose source.media_type is audio/*, application/pdf, text/plain, etc., to the multimodal embedding model.","commonSituations":"Feeding generic attachments (PDFs, audio) from a document pipeline into the embedding model; defaulting media_type incorrectly when constructing DataBlocks.","solutions":["Filter DataBlocks to image/* and video/* before calling the model","Use a document/audio-specific embedding or conversion pipeline for other media types","Set correct media_type values when building DataBlocks"],"exampleFix":"# before\nawait model(blocks)  # blocks may contain audio/pdf\n# after\nok = [b for b in blocks if b.source.media_type.startswith((\"image/\", \"video/\"))]\nawait model(ok)","handlingStrategy":"validation","validationCode":"blocks = [b for b in blocks if b.source.media_type.startswith((\\\"image/\\\", \\\"video/\\\"))]","typeGuard":"def is_supported_media(block) -> bool:\\n    return block.source.media_type.startswith((\\\"image/\\\", \\\"video/\\\"))","tryCatchPattern":"try:\\n    await model(blocks)\\nexcept ValueError as e:\\n    if \\\"Unsupported media type\\\" in str(e): blocks = [b for b in blocks if is_supported_media(b)]; await model(blocks)\\n    else: raise","preventionTips":["Set accurate media_type when creating DataBlocks","Segment pipelines by media kind before embedding"],"tags":["embedding","dashscope","multimodal","media-type"],"backgroundTag":"unsupported-input-format","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}