microsoft/semantic-kernel · error · ServiceInvalidResponseError

Unsupported content type in the response: {content}

Error message

Unsupported content type in the response: {content}

What it means

Raised in _parse_chat_message when a content block in the Bedrock response does not match any recognized key ('text', 'image', 'toolUse'). ServiceInvalidResponseError signals that the model returned a content type the connector cannot turn into a ChatMessageContent item (TextContent, ImageContent, or FunctionCallContent).

Source

Thrown at python/semantic_kernel/connectors/ai/bedrock/services/bedrock_chat_completion.py:257

                items.append(TextContent(text=content["text"], inner_content=content))
            elif "image" in content:
                items.append(
                    ImageContent(
                        data=content["image"]["source"]["bytes"],
                        mime_type=content["image"]["source"]["format"],
                        inner_content=content["image"],
                    )
                )
            elif "toolUse" in content:
                items.append(
                    FunctionCallContent(
                        id=content["toolUse"]["toolUseId"],
                        name=content["toolUse"]["name"],
                        arguments=content["toolUse"]["input"],
                    )
                )
            else:
                raise ServiceInvalidResponseError(f"Unsupported content type in the response: {content}")

        return ChatMessageContent(
            ai_model_id=self.ai_model_id,
            role=AuthorRole.ASSISTANT,
            items=items,
            inner_content=response,
            finish_reason=finish_reason,
            metadata={"usage": usage},
        )

    # region async helper methods

    async def _async_converse(self, **kwargs) -> Any:
        """Invoke the model asynchronously."""
        return await run_in_executor(
            None,
            partial(
                self.bedrock_runtime_client.converse,

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Upgrade the semantic-kernel Bedrock connector to a version supporting the new content type.
  2. If only text/tool output is needed, retry or constrain the request to avoid triggering the new content type.
  3. Inspect the 'content' dict to identify the unsupported key and file/track an issue.
Defensive patterns

Strategy: try-catch

Try / catch

from semantic_kernel.exceptions import ServiceInvalidResponseError
try:
    result = await service.get_chat_message_contents(history=history, settings=settings)
except ServiceInvalidResponseError as e:
    if "Unsupported content type" in str(e):
        # upgrade connector or retry; report the content dict for diagnosis
        ...

Prevention

When it happens

Trigger: A Bedrock model returns a content block with a new type (e.g. 'video', 'reasoning', 'document', 'toolResult' in an assistant turn) that the connector does not yet handle, or the response structure changed.

Common situations: New model capability (e.g. reasoning/thinking blocks) not yet supported by the connector; provider-specific content types; version mismatch between model output and connector parsers.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/223b173cfb2232ff. Report an issue: GitHub.