{"record":{"id":"afcdfca9655ebfee","repo":"microsoft/autogen","slug":"invalid-participant-component-type-participant-c","errorCode":null,"errorMessage":"Invalid participant component type: {participant.component_type}. Expected ChatAgent or Team.","messagePattern":"Invalid participant component type: (.+?)\\. Expected ChatAgent or Team\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py","lineNumber":709,"sourceCode":"            selector_prompt=self._selector_prompt,\n            allow_repeated_speaker=self._allow_repeated_speaker,\n            max_selector_attempts=self._max_selector_attempts,\n            # selector_func=self._selector_func.dump_component() if self._selector_func else None,\n            emit_team_events=self._emit_team_events,\n            model_client_streaming=self._model_client_streaming,\n            model_context=self._model_context.dump_component() if self._model_context else None,\n        )\n\n    @classmethod\n    def _from_config(cls, config: SelectorGroupChatConfig) -> Self:\n        participants: List[ChatAgent | Team] = []\n        for participant in config.participants:\n            if participant.component_type == ChatAgent.component_type:\n                participants.append(ChatAgent.load_component(participant))\n            elif participant.component_type == Team.component_type:\n                participants.append(Team.load_component(participant))\n            else:\n                raise ValueError(\n                    f\"Invalid participant component type: {participant.component_type}. \" \"Expected ChatAgent or Team.\"\n                )\n        return cls(\n            participants=participants,\n            model_client=ChatCompletionClient.load_component(config.model_client),\n            name=config.name,\n            description=config.description,\n            termination_condition=TerminationCondition.load_component(config.termination_condition)\n            if config.termination_condition\n            else None,\n            max_turns=config.max_turns,\n            selector_prompt=config.selector_prompt,\n            allow_repeated_speaker=config.allow_repeated_speaker,\n            max_selector_attempts=config.max_selector_attempts,\n            # selector_func=ComponentLoader.load_component(config.selector_func, Callable[[Sequence[BaseAgentEvent | BaseChatMessage]], str | None])\n            # if config.selector_func\n            # else None,\n            emit_team_events=config.emit_team_events,","sourceCodeStart":691,"sourceCodeEnd":727,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py#L691-L727","documentation":"SelectorGroupChat._from_config raises ValueError when deserializing a saved component config whose participant entries have a component_type that is neither ChatAgent's nor Team's. Component-based loading must dispatch each participant to the right loader, so unknown component types cannot be reconstructed.","triggerScenarios":"SelectorGroupChat.load_component(config) / Team.load_component where config.participants contains a component dict whose 'component_type' is e.g. 'model', 'tool', or a custom/misspelled type; hand-edited or cross-version exported component JSON.","commonSituations":"Manually crafting or editing component configs; loading a config produced by a different autogen version with changed component schemas; mixing component payloads from other frameworks.","solutions":["Regenerate the component config via team.dump_component() from the same autogen-agentchat version instead of hand-writing it.","Ensure each participant entry is a full serialized ChatAgent or Team component (has provider, config, component_type keys intact).","Validate participant component types before loading: all(p.component_type in (ChatAgent.component_type, Team.component_type) for p in config.participants)."],"exampleFix":"# before\nconfig = json.loads(open(\"team.json\").read())  # participant entry has component_type: \"agent\"  # invalid\n team = SelectorGroupChat.load_component(config)\n\n# after\n# re-export a valid config from a live team\nTeam.dump_component(team)  # then load this artifact","handlingStrategy":"validation","validationCode":"from autogen_agentchat.agents import ChatAgent\nfrom autogen_agentchat.teams import Team\nvalid_types = {ChatAgent.component_type, Team.component_type}\nassert all(p.component_type in valid_types for p in config.participants)\nteam = SelectorGroupChat.load_component(config)","typeGuard":"def has_valid_participant_types(config) -> bool:\n    valid = {ChatAgent.component_type, Team.component_type}\n    return all(p.component_type in valid for p in config.participants)","tryCatchPattern":"try:\n    team = SelectorGroupChat.load_component(config)\nexcept ValueError as e:\n    raise ValueError(f\"Component config invalid: {e}. Re-export with dump_component().\") from e","preventionTips":["Only load component configs produced by dump_component in the same package version.","Never hand-edit component_type fields in exported JSON."],"tags":["autogen","selector","component","serialization","config"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}