{"record":{"id":"21d2df9da75a163d","repo":"microsoft/semantic-kernel","slug":"unknown-event-type-in-the-response-event","errorCode":null,"errorMessage":"Unknown event type in the response: {event}","messagePattern":"Unknown event type in the response: (.+?)","errorType":"exception","errorClass":"ServiceInvalidResponseError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/bedrock/services/bedrock_chat_completion.py","lineNumber":151,"sourceCode":"        assert isinstance(settings, BedrockChatPromptExecutionSettings)  # nosec\n\n        prepared_settings = self._prepare_settings_for_request(chat_history, settings)\n        response_stream = await self._async_converse_streaming(**prepared_settings)\n        for event in response_stream.get(\"stream\"):\n            if \"messageStart\" in event:\n                yield [self._parse_message_start_event(event)]\n            elif \"contentBlockStart\" in event:\n                yield [self._parse_content_block_start_event(event)]\n            elif \"contentBlockDelta\" in event:\n                yield [self._parse_content_block_delta_event(event, function_invoke_attempt)]\n            elif \"contentBlockStop\" in event:\n                continue\n            elif \"messageStop\" in event:\n                yield [self._parse_message_stop_event(event)]\n            elif \"metadata\" in event:\n                yield [self._parse_metadata_event(event)]\n            else:\n                raise ServiceInvalidResponseError(f\"Unknown event type in the response: {event}\")\n\n    @override\n    def _update_function_choice_settings_callback(\n        self,\n    ) -> Callable[[\"FunctionCallChoiceConfiguration\", \"PromptExecutionSettings\", FunctionChoiceType], None]:\n        return update_settings_from_function_choice_configuration\n\n    @override\n    def _reset_function_choice_settings(self, settings: \"PromptExecutionSettings\") -> None:\n        if hasattr(settings, \"tool_choice\"):\n            settings.tool_choice = None\n        if hasattr(settings, \"tools\"):\n            settings.tools = None\n\n    @override\n    def _prepare_chat_history_for_request(\n        self,\n        chat_history: \"ChatHistory\",","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/bedrock/services/bedrock_chat_completion.py#L133-L169","documentation":"Raised while parsing a Bedrock streaming response when an event dict does not contain any of the recognized keys (messageStart, contentBlockStart, contentBlockDelta, contentBlockStop, messageStop, metadata). It is a ServiceInvalidResponseError indicating the Bedrock runtime returned an event shape the connector cannot interpret.","triggerScenarios":"Bedrock introduces a new event type in its response stream (e.g. a new signature/version field), or the response is malformed/truncated. Also possible with a regional model whose stream format differs, or an SDK/runtime version producing additional event keys.","commonSituations":"Bedrock API/runtime version change adding new event types; using a newer model whose stream includes unfamiliar events; transient corruption/truncation of the stream; connector version lagging behind the runtime.","solutions":["Upgrade the semantic-kernel Bedrock connector to a version that recognizes the new event type.","Inspect the logged event dict to identify the new/unexpected key and report it; filter or ignore unknown events only if safe for your use case.","Retry the request to rule out a transient malformed response; if persistent, switch to the non-streaming path."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import ServiceInvalidResponseError\ntry:\n    async for chunk in service.get_streaming_chat_message_contents(history=history, settings=settings):\n        process(chunk)\nexcept ServiceInvalidResponseError as e:\n    if \"Unknown event type\" in str(e):\n        # retry once; if persistent, fall back to non-streaming\n        result = await service.get_chat_message_contents(history=history, settings=settings)","preventionTips":["Keep the semantic-kernel Bedrock connector up to date.","Monitor for new Bedrock event types after runtime upgrades.","Have a non-streaming fallback for streaming parse failures."],"tags":["bedrock","streaming","response-parsing","version-compat","python"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}