{"record":{"id":"fad51d1204f94b33","repo":"microsoft/autogen","slug":"unsupported-content-type-type-c-in-message","errorCode":null,"errorMessage":"Unsupported content type: {type(c)} in {message}","messagePattern":"Unsupported content type: (.+?) in (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py","lineNumber":535,"sourceCode":"        # Return the assistant's response as a Response with inner messages\n        chat_message = TextMessage(source=self.name, content=text_content[0].text.value)\n        yield Response(chat_message=chat_message, inner_messages=inner_messages)\n\n    async def handle_incoming_message(self, message: BaseChatMessage, cancellation_token: CancellationToken) -> None:\n        \"\"\"Handle regular text messages by adding them to the thread.\"\"\"\n        content: str | List[MessageContentPartParam] | None = None\n        llm_message = message.to_model_message()\n        if isinstance(llm_message.content, str):\n            content = llm_message.content\n        else:\n            content = []\n            for c in llm_message.content:\n                if isinstance(c, str):\n                    content.append(TextContentBlockParam(text=c, type=\"text\"))\n                elif isinstance(c, Image):\n                    content.append(ImageURLContentBlockParam(image_url=ImageURLParam(url=c.data_uri), type=\"image_url\"))\n                else:\n                    raise ValueError(f\"Unsupported content type: {type(c)} in {message}\")\n        await cancellation_token.link_future(\n            asyncio.ensure_future(\n                self._client.beta.threads.messages.create(  # type: ignore[reportDeprecated]\n                    thread_id=self._thread_id,\n                    content=content,\n                    role=\"user\",\n                )\n            )\n        )\n\n    async def on_reset(self, cancellation_token: CancellationToken) -> None:\n        \"\"\"Handle reset command by deleting new messages and runs since initialization.\"\"\"\n        await self._ensure_initialized()\n\n        # Retrieve all message IDs in the thread\n        new_message_ids: List[str] = []\n        after: str | NotGiven = NOT_GIVEN\n        while True:","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py#L517-L553","documentation":"handle_incoming_message converts an incoming BaseChatMessage to an Assistants-API content payload. It supports exactly two content shapes: plain strings and lists whose elements are str or autogen Image (converted to an image_url data-URI part). Any other element type (e.g. a MultiModalVideo or unknown block) raises ValueError naming the type and message.","triggerScenarios":"Sending a MultiModalMessage whose content list contains anything besides str or Image — for example video blocks or custom content types from other autogen-ext packages.","commonSituations":"Piping rich multimodal messages (audio/video parts) from other agents or UIs into an OpenAIAssistantAgent; custom BaseChatMessage subclasses with novel content types.","solutions":["Send only text and images to OpenAIAssistantAgent: content strings or lists of str/Image.","Strip unsupported parts before forwarding: filter message content to str and Image instances.","Use OpenAIChatCompletionAgent or another agent type if you need broader multimodal input support."],"exampleFix":"# before\nawait agent.handle_incoming_message(\n    MultiModalMessage(source=\"user\", content=[\"look\", video_block]), ct)\n\n# after\nfrom autogen_core.models import Image\nsafe = [p for p in msg.content if isinstance(p, (str, Image))]\nawait agent.handle_incoming_message(\n    MultiModalMessage(source=\"user\", content=safe), ct)","handlingStrategy":"type-guard","validationCode":"from autogen_core.models import Image\n\ndef assistant_safe_content(content):\n    if isinstance(content, str):\n        return content\n    return [p for p in content if isinstance(p, (str, Image))]","typeGuard":"from autogen_core.models import Image\n\ndef is_supported_part(p: object) -> bool:\n    return isinstance(p, (str, Image))","tryCatchPattern":null,"preventionTips":["Send only str/Image content to OpenAIAssistantAgent.","Filter multimodal messages at the boundary before forwarding.","Route video/audio-heavy messages to agents that support them."],"tags":["openai","assistants-api","multimodal","validation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}