RoundRobinGroupChat raises raw AttributeError/TypeError for invalid participants instead of a clear validation error

Open Beginner friendly
#7,580 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
ai, backend

Research direction

Start at the RoundRobinGroupChat constructor and reproduce the three invalid participants cases shown in the issue. Trace where participants is first inspected, then verify that None, non-sequences, and sequences containing non-agent objects produce a clear validation error rather than raw AttributeError or TypeError.

Written by the indexing model from the issue text.

Description

needs-triage
What happened?

Describe the bug
Hi, I noticed that RoundRobinGroupChat does not seem to validate the type of the participants argument before using it.

When participants is accidentally set to None, a string, an integer, or a list containing a non-agent object, the constructor raises low-level Python errors such as:

  • TypeError: object of type 'NoneType' has no len()
  • TypeError: object of type 'int' has no len()
  • AttributeError: 'str' object has no attribute 'name'

I understand these are invalid inputs, but they are realistic user mistakes. It would be much easier to debug if AutoGen raised a clear TypeError or ValueError explaining that participants must be a non-empty list/sequence of ChatAgent instances.

To Reproduce
from autogen_agentchat.agents import UserProxyAgent
from autogen_agentchat.teams import RoundRobinGroupChat

Case 1: participants is None

RoundRobinGroupChat(participants=None)

Case 2: participants is not a sequence of agents

RoundRobinGroupChat(participants="not a list")

Case 3: participants contains a non-agent object

RoundRobinGroupChat(participants=[UserProxyAgent(name="valid_user"), "bad"])

Expected behavior
The constructor should reject these invalid inputs with a clear validation error, for example:

TypeError: participants must be a non-empty sequence of ChatAgent instances

or a similar ValueError explaining which item is invalid.

Actual behavior
The constructor raises internal implementation errors:

RoundRobinGroupChat(participants=None)
-> TypeError: object of type 'NoneType' has no len()

RoundRobinGroupChat(participants="not a list")
-> AttributeError: 'str' object has no attribute 'name'

RoundRobinGroupChat(participants=[UserProxyAgent(name="valid_user"), "bad"])
-> AttributeError: 'str' object has no attribute 'name'

** Environment**
Package: autogen-agentchat
Observed with the local AutoGen checkout / current environment.
Python: 3.13

Additional context
This is not a request to accept these inputs. The issue is only about error handling: invalid user input currently leaks internal AttributeError/TypeError instead of a clear validation message.

Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

AutoGen library version.

Python dev (main branch)

Other library version.

No response

Model used

No response

Model provider

None

Other model provider

No response

Python version

3.10

.NET version

None

Operating system

MacOS

Dominant language
Python
Stars
61.1k
Forks
9.2k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/autogen

All issues in microsoft/autogen

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.