mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #10489] TypeError in update_user_groups for Non-Admin Users
#119221
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jeannotdamoiseaux on GitHub (Feb 21, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10489
Affected File:
backend/open_webui/utils/oauth.py
Description:
When a non-admin user logs in via OAuth, the application throws a
TypeErrorin theupdate_user_groupsfunction. This error occurs because the variableuser_oauth_groupsis set toNonewhen the OAuth groups claim is not provided as a list. Consequently, operations like membership checks (e.g.,if group_model.name not in user_oauth_groups) fail sinceNoneis not iterable and the application does not start.Steps to Reproduce:
OAUTH_GROUPS_CLAIMdoes not yield a list for non-admin users.TypeError: argument of type 'NoneType' is not iterableupdate_user_groupslocated inbackend/open_webui/utils/oauth.py.Expected Behavior:
The application should handle the scenario by ensuring that
user_oauth_groupsis always an iterable (e.g., an empty list when no groups are provided), allowing the login and group update processes to complete without error.Actual Behavior:
The code assigns
user_oauth_groupstoNoneif the claim data is not a list:This causes a
TypeErrorwhen attempting to iterate or check membership.Proposed Fix:
Modify the assignment to default to an empty list instead of None:
Please let me know what you think.
@tjbck commented on GitHub (Feb 21, 2025):
PR welcome!
@jeannotdamoiseaux commented on GitHub (Feb 21, 2025):
@tjbck , please see #10549.