agentscope-ai/agentscope · error · ValueError
Multimodal embedding API only supports URL input for video d
Error message
Multimodal embedding API only supports URL input for video data, got {type(source).__name__}. What it means
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.
Source
Thrown at src/agentscope/embedding/_dashscope/_model.py:512
block (`DataBlock`):
A data block with a ``Base64Source`` or ``URLSource``.
Returns:
`dict[str, str]`: E.g.
``{"image": "data:image/png;base64,..."}`` or
``{"video": "https://..."}``.
Raises:
`ValueError`: If the media type is unsupported or a video
block uses a non-URL source.
"""
source = block.source
media_type = source.media_type
if media_type.startswith("video/"):
if not isinstance(source, URLSource):
raise ValueError(
"Multimodal embedding API only supports URL input "
f"for video data, got {type(source).__name__}.",
)
return {"video": str(source.url)}
if media_type.startswith("image/"):
if isinstance(source, Base64Source):
return {
"image": f"data:{media_type};" f"base64,{source.data}",
}
if isinstance(source, URLSource):
return {"image": str(source.url)}
raise ValueError(
f"Unsupported media type {media_type!r} in DataBlock. "
f"Expected image/* or video/*.",
)
View on GitHub (pinned to e90f1c7592)
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
Example fix
# before DataBlock(source=Base64Source(media_type="video/mp4", data=b64)) # after DataBlock(source=URLSource(url="https://cdn.example.com/clip.mp4"))
Defensive patterns
Strategy: type-guard
Validate before calling
from agentscope.message import URLSource if block.source.media_type.startswith(\"video/\") and not isinstance(block.source, URLSource):\n block.source = URLSource(url=upload(block.source.data))
Type guard
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)
Try / catch
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
Prevention
- Upload local videos to object storage before embedding
- Route only image data through base64
When it happens
Trigger: Passing a DataBlock with media_type video/* whose source is Base64Source (raw bytes) instead of URLSource.
Common situations: 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.
Related errors
- Invalid input: {item!r}. Expected str or DataBlock.
- DashScope multimodal embedding API error: {res}
- Unsupported media type {media_type!r} in DataBlock. Expected
- Text embedding model {self.model!r} only accepts str inputs,
- DashScope text embedding API error: {response}
AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28).
Data as JSON: /api/errors/32e2863a9409b703.
Report an issue: GitHub.