{"record":{"id":"ea1aac01e092a178","repo":"microsoft/autogen","slug":"error-content-mime-type-is-not-supported-only","errorCode":null,"errorMessage":"Error: {content.mime_type} is not supported. Only MemoryMimeType.TEXT, MemoryMimeType.JSON, and MemoryMimeType.MARKDOWN are currently supported.","messagePattern":"Error: (.+?) is not supported\\. Only MemoryMimeType\\.TEXT, MemoryMimeType\\.JSON, and MemoryMimeType\\.MARKDOWN are currently supported\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/memory/redis/_redis_memory.py","lineNumber":252,"sourceCode":"            memories RedisMemory creates a vector embedding from the content field of a\n            MemoryContent object. This content is assumed to be text, JSON, or Markdown, and is\n            passed to the vector embedding model specified in RedisMemoryConfig.\n\n        Args:\n            content (MemoryContent): The memory content to store within Redis.\n            cancellation_token (CancellationToken): Token passed to cease operation. Not used.\n        \"\"\"\n        if content.mime_type == MemoryMimeType.TEXT:\n            memory_content = content.content\n            mime_type = \"text/plain\"\n        elif content.mime_type == MemoryMimeType.JSON:\n            memory_content = serialize(content.content)\n            mime_type = \"application/json\"\n        elif content.mime_type == MemoryMimeType.MARKDOWN:\n            memory_content = content.content\n            mime_type = \"text/markdown\"\n        else:\n            raise NotImplementedError(\n                f\"Error: {content.mime_type} is not supported. Only MemoryMimeType.TEXT, MemoryMimeType.JSON, and MemoryMimeType.MARKDOWN are currently supported.\"\n            )\n        metadata = {\"mime_type\": mime_type}\n        metadata.update(content.metadata if content.metadata else {})\n        self.message_history.add_message(\n            {\"role\": \"user\", \"content\": memory_content, \"metadata\": serialize(metadata)}  # type: ignore[reportArgumentType]\n        )\n\n    async def query(\n        self,\n        query: str | MemoryContent,\n        cancellation_token: CancellationToken | None = None,\n        **kwargs: Any,\n    ) -> MemoryQueryResult:\n        \"\"\"Query memory content based on semantic vector similarity.\n\n        .. note::\n","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/memory/redis/_redis_memory.py#L234-L270","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Filter adds to TEXT/JSON/MARKDOWN only; skip or transform image/binary items before RedisMemory.add.","Store images out-of-band (object storage) and keep a textual reference in memory with metadata pointing at the asset.","Pick a memory backend whose supported types match your content pipeline."],"exampleFix":"# before\nawait redis_memory.add(MemoryContent(content=Image.from_pil(img), mime_type=MemoryMimeType.IMAGE))  # NotImplementedError\n\n# after\nif content.mime_type in (MemoryMimeType.TEXT, MemoryMimeType.JSON, MemoryMimeType.MARKDOWN):\n    await redis_memory.add(content)","handlingStrategy":"type-guard","validationCode":"from autogen_core.memory import MemoryMimeType\n\nREDIS_OK = {MemoryMimeType.TEXT, MemoryMimeType.JSON, MemoryMimeType.MARKDOWN}\n\ndef redis_addable(item) -> bool:\n    return item.mime_type in REDIS_OK","typeGuard":"def is_redis_supported_mime(mime: MemoryMimeType) -> bool:\n    return mime in (MemoryMimeType.TEXT, MemoryMimeType.JSON, MemoryMimeType.MARKDOWN)","tryCatchPattern":"try:\n    await redis_memory.add(item)\nexcept NotImplementedError:\n    logger.warning('unsupported mime %s skipped', item.mime_type)","preventionTips":["Gate every add() with the three-mime allowlist","Convert binary/image content to text references before ingest","Keep backend-specific allowlists in one place"],"tags":["redis","memory","mime-type","validation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}