{"record":{"id":"0f7272b289a0f2d3","repo":"microsoft/semantic-kernel","slug":"no-messages-in-the-chat-history","errorCode":null,"errorMessage":"No messages in the chat history.","messagePattern":"No messages in the chat history\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/samples/getting_started_with_agents/multi_agent_orchestration/step3b_group_chat_with_chat_completion_manager.py","lineNumber":277,"sourceCode":"        )\n        print(\"*********************\")\n\n        if participant_name_with_reason.result in participant_descriptions:\n            return participant_name_with_reason\n\n        raise RuntimeError(f\"Unknown participant selected: {response.content}.\")\n\n    @override\n    async def filter_results(\n        self,\n        chat_history: ChatHistory,\n    ) -> MessageResult:\n        \"\"\"Provide concrete implementation for filtering the results of the discussion.\n\n        The manager will filter the results of the conversation after the conversation is terminated.\n        \"\"\"\n        if not chat_history.messages:\n            raise RuntimeError(\"No messages in the chat history.\")\n\n        chat_history.messages.insert(\n            0,\n            ChatMessageContent(\n                role=AuthorRole.SYSTEM,\n                content=await self._render_prompt(\n                    self.result_filter_prompt,\n                    KernelArguments(topic=self.topic),\n                ),\n            ),\n        )\n        chat_history.add_message(\n            ChatMessageContent(role=AuthorRole.USER, content=\"Please summarize the discussion.\"),\n        )\n\n        response = await self.service.get_chat_message_content(\n            chat_history,\n            settings=PromptExecutionSettings(response_format=StringResult),","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/samples/getting_started_with_agents/multi_agent_orchestration/step3b_group_chat_with_chat_completion_manager.py#L259-L295","documentation":"Thrown by the group-chat manager's filter_results when it is asked to summarize the discussion but chat_history.messages is empty. The result-filter prompt needs prior messages to synthesize a result; with none present it cannot proceed. This indicates the manager's filter was invoked before any participant contributed.","triggerScenarios":"filter_results called on a chat history that never received messages — e.g. every participant declined/errored, the conversation terminated immediately, or the termination condition fired before any turn.","commonSituations":"Misconfigured termination/selection policies that end the chat on the first turn before any agent speaks; an early Exit event or exception swallowing all messages; calling the manager manually with a fresh ChatHistory.","solutions":["Review the selection and termination strategies so at least one participant produces a message before results are filtered.","Guard filter_results to return a default message when chat_history.messages is empty instead of raising, if an empty discussion is legitimate.","Ensure participants don't error out before contributing (check upstream agent exceptions).","Confirm the orchestration isn't terminated by an immediate Exit condition."],"exampleFix":"# before\nif not chat_history.messages:\n    raise RuntimeError(\"No messages in the chat history.\")\n# after (graceful default)\nif not chat_history.messages:\n    return MessageResult(result=\"No discussion occurred.\", reason=\"Empty history.\")","handlingStrategy":"validation","validationCode":"if not chat_history.messages:\n    # return a safe default rather than calling filter_results\n    return MessageResult(result='No discussion occurred.', reason='Empty history.')","typeGuard":"def has_messages(chat_history) -> bool:\n    return bool(getattr(chat_history, 'messages', None))","tryCatchPattern":"try:\n    result = await manager.filter_results(chat_history)\nexcept RuntimeError as e:\n    if 'No messages' in str(e):\n        result = MessageResult(result='No discussion occurred.', reason='Empty history.')\n    else:\n        raise","preventionTips":["Ensure at least one participant contributes before results are filtered.","Review selection/termination strategies so the chat doesn't end on turn zero.","Guard empty-history case explicitly.","Check that no participant silently swallowed its turn."],"tags":["agents","orchestration","group-chat","empty-state","multi-agent"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}