{"record":{"id":"ac5fff7cc57d7540","repo":"microsoft/autogen","slug":"the-group-chat-has-not-been-initialized-it-must-b-ac5fff","errorCode":null,"errorMessage":"The group chat has not been initialized. It must be run before it can be paused.","messagePattern":"The group chat has not been initialized\\. It must be run before it can be paused\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py","lineNumber":689,"sourceCode":"        participant, and if the participant does not implement the method, it\n        will be a no-op.\n\n        .. note::\n\n            It is the responsibility of the agent class to handle the pause\n            and ensure that the agent can be resumed later.\n            Make sure to implement the :meth:`~autogen_agentchat.agents.BaseChatAgent.on_pause`\n            method in your agent class for custom pause behavior.\n            By default, the agent will not do anything when called.\n\n        Raises:\n            RuntimeError: If the team has not been initialized. Exceptions from\n                the participants when calling their implementations of\n                :class:`~autogen_agentchat.base.ChatAgent.on_pause` are\n                propagated to this method and raised.\n        \"\"\"\n        if not self._initialized:\n            raise RuntimeError(\"The group chat has not been initialized. It must be run before it can be paused.\")\n\n        # Send a pause message to all participants.\n        for participant_topic_type in self._participant_topic_types:\n            await self._runtime.send_message(\n                GroupChatPause(),\n                recipient=AgentId(type=participant_topic_type, key=self._team_id),\n            )\n        # Send a pause message to the group chat manager.\n        await self._runtime.send_message(\n            GroupChatPause(),\n            recipient=AgentId(type=self._group_chat_manager_topic_type, key=self._team_id),\n        )\n\n    async def resume(self) -> None:\n        \"\"\"Resume its participants when the team is running and paused by calling their\n        :meth:`~autogen_agentchat.base.ChatAgent.on_resume` method via direct RPC calls.\n\n        .. attention::","sourceCodeStart":671,"sourceCodeEnd":707,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py#L671-L707","documentation":"pause() sends GroupChatPause control messages to participants over the runtime, which requires the runtime agents to be registered — that happens during _init() on the first run(). Calling pause() on a never-run team raises RuntimeError instead of sending messages into an uninitialized runtime.","triggerScenarios":"Constructing a team and calling await team.pause() before any await team.run(...) / run_stream(...) has initialized it.","commonSituations":"Startup scripts that pause teams preemptively; wiring pause/resume buttons in a UI before the first session run; restoring a saved state with load_state (which does init) but forgetting it, then pausing.","solutions":["Run the team at least once (or call load_state, which initializes) before pause().","Track initialization in your app (e.g. a session_started flag) and disable the pause action until then.","Wrap pause() in try/except RuntimeError if pausing pre-run should be a no-op in your app."],"exampleFix":"# before\nteam = RoundRobinGroupChat([agent])\nawait team.pause()  # RuntimeError\n\n# after\nteam = RoundRobinGroupChat([agent])\nrun_task = asyncio.create_task(team.run(task=\"hello\"))\nawait asyncio.sleep(1)\nawait team.pause()  # ok: initialized by the run","handlingStrategy":"validation","validationCode":"if not getattr(team, \"_initialized\", False):\n    raise RuntimeError(\"team must run once before pause() is available\")\nawait team.pause()","typeGuard":null,"tryCatchPattern":"try:\n    await team.pause()\nexcept RuntimeError as e:\n    if \"must be run\" in str(e):\n        pass  # nothing to pause yet — treat as no-op\n    else:\n        raise","preventionTips":["Gate pause/resume UI actions on 'session has run at least once'.","After process restart, load_state() or run once before using pause/resume.","Implement on_pause/on_resume in custom agents so pausing is meaningful."],"tags":["python","autogen","lifecycle","pause-resume"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}