{"record":{"id":"32e2863a9409b703","repo":"agentscope-ai/agentscope","slug":"multimodal-embedding-api-only-supports-url-input-f","errorCode":null,"errorMessage":"Multimodal embedding API only supports URL input for video data, got {type(source).__name__}.","messagePattern":"Multimodal embedding API only supports URL input for video data, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/embedding/_dashscope/_model.py","lineNumber":512,"sourceCode":"            block (`DataBlock`):\n                A data block with a ``Base64Source`` or ``URLSource``.\n\n        Returns:\n            `dict[str, str]`: E.g.\n            ``{\"image\": \"data:image/png;base64,...\"}`` or\n            ``{\"video\": \"https://...\"}``.\n\n        Raises:\n            `ValueError`: If the media type is unsupported or a video\n                block uses a non-URL source.\n        \"\"\"\n\n        source = block.source\n        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":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/embedding/_dashscope/_model.py#L494-L530","documentation":"The DashScope multimodal embedding API can only ingest video as a public URL, so _format_data_block rejects video DataBlocks whose source is not URLSource (e.g. Base64Source) before ever calling the API.","triggerScenarios":"Passing a DataBlock with media_type video/* whose source is Base64Source (raw bytes) instead of URLSource.","commonSituations":"Reusing an image pipeline that base64-encodes local files and pointing it at video files; uploading user-uploaded videos stored locally with no public URL.","solutions":["Host the video at a URL reachable by DashScope and pass DataBlock(source=URLSource(url=...))","If you only have local video, upload it to object storage (OSS/S3) first and embed the public/pre-signed URL","Extract frames and embed them as images if video URLs are impossible"],"exampleFix":"# before\nDataBlock(source=Base64Source(media_type=\"video/mp4\", data=b64))\n# after\nDataBlock(source=URLSource(url=\"https://cdn.example.com/clip.mp4\"))","handlingStrategy":"type-guard","validationCode":"from agentscope.message import URLSource\nif block.source.media_type.startswith(\\\"video/\\\") and not isinstance(block.source, URLSource):\\n    block.source = URLSource(url=upload(block.source.data))","typeGuard":"def video_has_url_source(block) -> bool:\\n    from agentscope.message import URLSource\\n    return not block.source.media_type.startswith(\\\"video/\\\") or isinstance(block.source, URLSource)","tryCatchPattern":"try:\\n    await model([block])\\nexcept ValueError as e:\\n    if \\\"URL input for video\\\" in str(e): block.source = URLSource(url=host_video(block)); await model([block])\\n    else: raise","preventionTips":["Upload local videos to object storage before embedding","Route only image data through base64"],"tags":["embedding","dashscope","multimodal","video","input-format"],"backgroundTag":"unsupported-input-format","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}