microsoft/autogen · error · NotImplementedError

Error: {mime_type} is not supported. Only MemoryMimeType.TEX

Error message

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

What it means

When RedisMemory deserializes stored rows back into MemoryContent, it pops 'mime_type' from the stored metadata and maps the string through MemoryMimeType(...). If the stored MIME string is not one of text/plain, text/markdown, application/json (the only ones add() ever writes), reconstruction raises NotImplementedError. This indicates corrupt or foreign data in the Redis index.

Source

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

                raise TypeError("'query' must be either a string or MemoryContent")

            results = self.message_history.get_relevant(  # type: ignore
                prompt=prompt,  # type: ignore[reportArgumentType]
                top_k=top_k,
                distance_threshold=distance_threshold,
                raw=False,
            )

        memories: List[MemoryContent] = []
        for result in results:  # type: ignore[reportUnkownVariableType]
            metadata = deserialize(result["metadata"])  # type: ignore[reportArgumentType]
            mime_type = MemoryMimeType(metadata.pop("mime_type"))
            if mime_type in (MemoryMimeType.TEXT, MemoryMimeType.MARKDOWN):
                memory_content = result["content"]  # type: ignore[reportArgumentType]
            elif mime_type == MemoryMimeType.JSON:
                memory_content = deserialize(result["content"])  # type: ignore[reportArgumentType]
            else:
                raise NotImplementedError(
                    f"Error: {mime_type} is not supported. Only MemoryMimeType.TEXT, MemoryMimeType.JSON, and MemoryMimeType.MARKDOWN are currently supported."
                )
            memory = MemoryContent(
                content=memory_content,  # type: ignore[reportArgumentType]
                mime_type=mime_type,
                metadata=metadata,
            )
            memories.append(memory)  # type: ignore[reportUknownMemberType]

        return MemoryQueryResult(results=memories)  # type: ignore[reportUknownMemberType]

    async def clear(self) -> None:
        """Clear all entries from memory, preserving the RedisMemory resources."""
        self.message_history.clear()

    async def close(self) -> None:
        """Clears all entries from memory, and cleans up Redis client, index and resources."""
        self.message_history.delete()

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Use a dedicated index_name per application/version in RedisMemoryConfig so foreign rows never mix in.
  2. Delete or re-write the offending rows: scan the index, fix or drop entries whose metadata.mime_type is outside the supported set, or clear() the memory.
  3. If you control the writers, standardize on the three supported mime strings before inserting into Redis.

Example fix

# before (foreign row in index: metadata {"mime_type": "text/html"})
results = await memory.query('anything')  # NotImplementedError on deserialize

# after
await memory.clear()  # or delete offending keys, then re-add supported content
results = await memory.query('anything')
Defensive patterns

Strategy: try-catch

Validate before calling

SUPPORTED_MIMES = {'text/plain', 'text/markdown', 'application/json'}

async def scan_for_bad_rows(memory) -> int:
    # use RedisVL index scan on metadata.mime_type outside the supported set
    ...

Try / catch

try:
    results = await memory.query(q)
except NotImplementedError as e:
    if 'not supported' in str(e):
        logger.error('foreign rows in index; clearing and rebuilding memory')
        await memory.clear()
        results = await memory.query(q)
    else:
        raise

Prevention

When it happens

Trigger: Rows written to the same RedisVL index by another application with different mime_type metadata values (e.g. 'image/png', 'text/html'); manually edited/imported Redis entries; a MemoryContent stored by a newer/older version with a wider mime mapping.

Common situations: Sharing a Redis index between services; running migration scripts that inserted records directly; schema drift between environments writing to the same Redis instance.

Related errors


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