microsoft/autogen · error · RuntimeError
The group chat has not been initialized. It must be run…
Error message
The group chat has not been initialized. It must be run before it can be paused.
What it means
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.
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.
Example fix
# before team = RoundRobinGroupChat([agent]) await team.pause() # RuntimeError # after team = RoundRobinGroupChat([agent]) run_task = asyncio.create_task(team.run(task="hello")) await asyncio.sleep(1) await team.pause() # ok: initialized by the run
Defensive patterns
Strategy: validation
Validate before calling
if not getattr(team, "_initialized", False):
raise RuntimeError("team must run once before pause() is available")
await team.pause() Try / catch
try:
await team.pause()
except RuntimeError as e:
if "must be run" in str(e):
pass # nothing to pause yet — treat as no-op
else:
raise Prevention
- 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.
When it happens
Trigger: Constructing a team and calling await team.pause() before any await team.run(...) / run_stream(...) has initialized it.
Common situations: 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.
Related errors
- The group chat has not been initialized. It must be run…
- Connection is not open.
- Host connection is not set.
- Runtime is already running.
- Runtime is not running.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/ac5fff7cc57d7540.
Report an issue: GitHub.
Appendix: source
Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py:689
participant, and if the participant does not implement the method, it
will be a no-op.
.. note::
It is the responsibility of the agent class to handle the pause
and ensure that the agent can be resumed later.
Make sure to implement the :meth:`~autogen_agentchat.agents.BaseChatAgent.on_pause`
method in your agent class for custom pause behavior.
By default, the agent will not do anything when called.
Raises:
RuntimeError: If the team has not been initialized. Exceptions from
the participants when calling their implementations of
:class:`~autogen_agentchat.base.ChatAgent.on_pause` are
propagated to this method and raised.
"""
if not self._initialized:
raise RuntimeError("The group chat has not been initialized. It must be run before it can be paused.")
# Send a pause message to all participants.
for participant_topic_type in self._participant_topic_types:
await self._runtime.send_message(
GroupChatPause(),
recipient=AgentId(type=participant_topic_type, key=self._team_id),
)
# Send a pause message to the group chat manager.
await self._runtime.send_message(
GroupChatPause(),
recipient=AgentId(type=self._group_chat_manager_topic_type, key=self._team_id),
)
async def resume(self) -> None:
"""Resume its participants when the team is running and paused by calling their
:meth:`~autogen_agentchat.base.ChatAgent.on_resume` method via direct RPC calls.
.. attention::View on GitHub (pinned to 027ecf0a37)