microsoft/autogen · error · ValueError
Unsupported content type: {mime_type}
Error message
Unsupported content type: {mime_type} What it means
The teachability text converter handles TEXT, MARKDOWN, JSON (dict), and Image; any other mime_type falls into the terminal else branch and raises with the unsupported value embedded in the message.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/teachability.py:53
def _extract_text(self, content_item: str | MemoryContent) -> str:
"""Extract searchable text from content."""
if isinstance(content_item, str):
return content_item
content = content_item.content
mime_type = content_item.mime_type
if mime_type in [MemoryMimeType.TEXT, MemoryMimeType.MARKDOWN]:
return str(content)
elif mime_type == MemoryMimeType.JSON:
if isinstance(content, dict):
# Store original JSON string representation
return str(content).lower()
raise ValueError("JSON content must be a dict")
elif isinstance(content, Image):
raise ValueError("Image content cannot be converted to text")
else:
raise ValueError(f"Unsupported content type: {mime_type}")
async def update_context(
self,
model_context: ChatCompletionContext,
) -> UpdateContextResult:
"""
Extracts any advice from the last user turn to be stored in memory,
and adds any relevant memories to the model context.
"""
self._logger.enter_function()
# Extract text from the user's last message
messages = await model_context.get_messages()
if not messages:
self._logger.leave_function()
return UpdateContextResult(memories=MemoryQueryResult(results=[]))
last_message = messages[-1]
last_user_text = last_message.content if isinstance(last_message.content, str) else str(last_message)View on GitHub (pinned to 027ecf0a37)
Solutions
- Check the mime_type printed in the message and convert to TEXT/MARKDOWN before storage.
- Add a branch for that mime type (if contributing upstream) or bypass teachability for that content type.
- Gate memory additions: only add contents whose mime_type is in {TEXT, MARKDOWN, JSON-with-dict}.
Example fix
# before await memory.add(MemoryContent(content=b"...", mime_type=MemoryMimeType.BINARY)) # after await memory.add(MemoryContent(content="summary of binary blob", mime_type=MemoryMimeType.TEXT))
Defensive patterns
Strategy: type-guard
Validate before calling
from autogen_core.memory import MemoryMimeType
SUPPORTED = {MemoryMimeType.TEXT, MemoryMimeType.MARKDOWN, MemoryMimeType.JSON}
assert c.mime_type in SUPPORTED, f"teachability cannot process {c.mime_type}" Type guard
def is_supported_teachability_mime(mime_type) -> bool:
return mime_type in {MemoryMimeType.TEXT, MemoryMimeType.MARKDOWN, MemoryMimeType.JSON} Prevention
- Whitelist mime types before adding content to teachability memory.
- After upgrading autogen, re-check the supported set — new enum members may not be handled.
When it happens
Trigger: Creating MemoryContent with a mime_type outside the supported set (e.g. MemoryMimeType.IMAGE binary, AUDIO, VIDEO, or a custom enum value) and routing it through teachability's update_context/query.
Common situations: New MemoryMimeType enum members added in newer autogen versions not yet handled here; mixing generic memory contents into the teachable memory; custom mime types.
Related errors
- JSON content must be a dict
- Image content cannot be converted to text
- JSON content must be a dict
- Unsupported content type: {mime_type}
- Error: {content.mime_type} is not supported. Only MemoryMime
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/648958858588a2f6.
Report an issue: GitHub.