microsoft/autogen · error · ValueError

Agent state for {self._group_chat_manager_name} not found in

Error message

Agent state for {self._group_chat_manager_name} not found in the saved state.

What it means

After participant states are loaded, load_state() also requires an entry for the group chat manager itself (named e.g. 'group_chat_manager' per the team type) in team_state.agent_states. Missing manager state means the saved checkpoint predates the manager-state feature or came from a different team type.

Source

Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py:823

        if not self._initialized:
            await self._init(self._runtime)

        if self._is_running:
            raise RuntimeError("The team cannot be loaded while it is running.")
        self._is_running = True

        try:
            team_state = TeamState.model_validate(state)
            # Load the state of all participants.
            for name, agent_type in zip(self._participant_names, self._participant_topic_types, strict=True):
                agent_id = AgentId(type=agent_type, key=self._team_id)
                if name not in team_state.agent_states:
                    raise ValueError(f"Agent state for {name} not found in the saved state.")
                await self._runtime.agent_load_state(agent_id, team_state.agent_states[name])
            # Load the state of the group chat manager.
            agent_id = AgentId(type=self._group_chat_manager_topic_type, key=self._team_id)
            if self._group_chat_manager_name not in team_state.agent_states:
                raise ValueError(f"Agent state for {self._group_chat_manager_name} not found in the saved state.")
            await self._runtime.agent_load_state(agent_id, team_state.agent_states[self._group_chat_manager_name])

        except ValidationError as e:
            raise ValueError(
                "Invalid state format. The expected state format has changed since v0.4.9. "
                "Please read the release note on GitHub."
            ) from e

        finally:
            # Indicate that the team is no longer running.
            self._is_running = False

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Re-save the state with the current library version so the manager entry is included.
  2. If migrating manually, add a valid manager state entry under the manager's name (inspect TeamState and the manager's save_state output for the schema).
  3. Check the exact expected name via the team's group_chat_manager_name / saved keys before loading.

Example fix

# before
await team.load_state({"agent_states": {"assistant": {...}}})  # no manager entry

# after
await team.load_state({"agent_states": {"assistant": {...}, "group_chat_manager": {...}}})  # include manager state from save_state()
Defensive patterns

Strategy: validation

Validate before calling

mgr = team._group_chat_manager_name
if mgr not in state.get("agent_states", {}):
    raise ValueError(f"saved state lacks manager entry '{mgr}'; re-save with the current version")
await team.load_state(state)

Prevention

When it happens

Trigger: Calling load_state() with a state dict whose agent_states lacks the key matching self._group_chat_manager_name — typically a state saved by an older version or one assembled manually without the manager entry.

Common situations: Upgrading AutoGen and loading pre-upgrade checkpoints; mixing state files between team classes; hand-crafted state dicts for testing.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/f5c1c6b41e2d1fc2. Report an issue: GitHub.