microsoft/autogen · error · NotImplementedError

Error: {content.mime_type} is not supported. Only MemoryMime

Error message

Error: {content.mime_type} is not supported. Only MemoryMimeType.TEXT, MemoryMimeType.JSON, and MemoryMimeType.MARKDOWN are currently supported.

What it means

RedisMemory.add only accepts MemoryMimeType.TEXT, JSON, and MARKDOWN, because it maps each to a concrete MIME string ('text/plain', 'application/json', 'text/markdown') before writing into RedisVL MessageHistory. Any other mime type (IMAGE, BINARY) raises NotImplementedError — the backend has no serialization path for it.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/memory/redis/_redis_memory.py:252

            memories RedisMemory creates a vector embedding from the content field of a
            MemoryContent object. This content is assumed to be text, JSON, or Markdown, and is
            passed to the vector embedding model specified in RedisMemoryConfig.

        Args:
            content (MemoryContent): The memory content to store within Redis.
            cancellation_token (CancellationToken): Token passed to cease operation. Not used.
        """
        if content.mime_type == MemoryMimeType.TEXT:
            memory_content = content.content
            mime_type = "text/plain"
        elif content.mime_type == MemoryMimeType.JSON:
            memory_content = serialize(content.content)
            mime_type = "application/json"
        elif content.mime_type == MemoryMimeType.MARKDOWN:
            memory_content = content.content
            mime_type = "text/markdown"
        else:
            raise NotImplementedError(
                f"Error: {content.mime_type} is not supported. Only MemoryMimeType.TEXT, MemoryMimeType.JSON, and MemoryMimeType.MARKDOWN are currently supported."
            )
        metadata = {"mime_type": mime_type}
        metadata.update(content.metadata if content.metadata else {})
        self.message_history.add_message(
            {"role": "user", "content": memory_content, "metadata": serialize(metadata)}  # type: ignore[reportArgumentType]
        )

    async def query(
        self,
        query: str | MemoryContent,
        cancellation_token: CancellationToken | None = None,
        **kwargs: Any,
    ) -> MemoryQueryResult:
        """Query memory content based on semantic vector similarity.

        .. note::

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Filter adds to TEXT/JSON/MARKDOWN only; skip or transform image/binary items before RedisMemory.add.
  2. Store images out-of-band (object storage) and keep a textual reference in memory with metadata pointing at the asset.
  3. Pick a memory backend whose supported types match your content pipeline.

Example fix

# before
await redis_memory.add(MemoryContent(content=Image.from_pil(img), mime_type=MemoryMimeType.IMAGE))  # NotImplementedError

# after
if content.mime_type in (MemoryMimeType.TEXT, MemoryMimeType.JSON, MemoryMimeType.MARKDOWN):
    await redis_memory.add(content)
Defensive patterns

Strategy: type-guard

Validate before calling

from autogen_core.memory import MemoryMimeType

REDIS_OK = {MemoryMimeType.TEXT, MemoryMimeType.JSON, MemoryMimeType.MARKDOWN}

def redis_addable(item) -> bool:
    return item.mime_type in REDIS_OK

Type guard

def is_redis_supported_mime(mime: MemoryMimeType) -> bool:
    return mime in (MemoryMimeType.TEXT, MemoryMimeType.JSON, MemoryMimeType.MARKDOWN)

Try / catch

try:
    await redis_memory.add(item)
except NotImplementedError:
    logger.warning('unsupported mime %s skipped', item.mime_type)

Prevention

When it happens

Trigger: await redis_memory.add(MemoryContent(content=Image.from_pil(img), mime_type=MemoryMimeType.IMAGE)); adding binary payloads; passing a MemoryContent built from raw bytes with an unsupported enum member.

Common situations: Multimodal agent flows feeding the full message history into memory without filtering; shared content builders assuming every backend accepts every mime type; upgrading autogen-ext where MemoryMimeType gained new members.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/ea1aac01e092a178. Report an issue: GitHub.