Skip to content

fix: validate participants type in BaseGroupChat.__init__#7607

Open
nileshpatil6 wants to merge 2 commits intomicrosoft:mainfrom
nileshpatil6:fix/participants-type-validation
Open

fix: validate participants type in BaseGroupChat.__init__#7607
nileshpatil6 wants to merge 2 commits intomicrosoft:mainfrom
nileshpatil6:fix/participants-type-validation

Conversation

@nileshpatil6
Copy link
Copy Markdown

Problem

Passing a non-list value (None, int, str) as participants to RoundRobinGroupChat (or any BaseGroupChat subclass) causes a cryptic AttributeError or TypeError deep in the call stack — e.g., 'NoneType' object has no attribute '__len__' or errors inside set(participant.name for participant in participants).

Fix

Add an explicit isinstance(participants, list) check before the len() call so the error is caught immediately at construction time with a clear message:

TypeError: participants must be a list of ChatAgent or Team instances, got 'NoneType'.

Fixes #7580

Passing a non-list value (None, int, str) as participants causes a
cryptic AttributeError or TypeError deep in the stack. Adding an
explicit isinstance check before len() surfaces a clear TypeError
immediately at construction time.

Fixes microsoft#7580
@nileshpatil6
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Passing a non-list value (None, int, str) as participants causes a
cryptic AttributeError or TypeError deep in the stack. Adding an
explicit isinstance check before len() surfaces a clear TypeError
immediately at construction time.

Fixes microsoft#7580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant