litellm
litellm copied to clipboard
[Bug]: 'NoneType' object is not iterable in _get_user_info_for_proxy_admin()
What happened?
Every time I log-in to the LiteLLM Admin Panel ui I've got the following error notification message:
Looking at the stack trace, the error originates in litellm/proxy/management_endpoints/internal_user_endpoints.py.
Specifically:
- The
user_info()function calls_get_user_info_for_proxy_admin(). - Inside
_get_user_info_for_proxy_admin(), there's aforloop:for key in _keys_in_db:. - The error occurs because
_keys_in_dbisNoneat the time the loop is executed. This means that whatever logic is supposed to populate_keys_in_dbbefore the loop is not working correctly and is returningNoneinstead of an iterable (like a list).
Here is the relevant log output in json format:
{"message": "litellm.proxy.proxy_server.user_info(): Exception occured - 'NoneType' object is not iterable", "level": "ERROR", "timestamp": "2024-12-06T13:45:06.592580", "stacktrace": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.11/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py\", line 308, in user_info\n return await _get_user_info_for_proxy_admin()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py\", line 431, in _get_user_info_for_proxy_admin\n for key in _keys_in_db:\nTypeError: 'NoneType' object is not iterable"}
Relevant log output
{"message": "litellm.proxy.proxy_server.user_info(): Exception occured - 'NoneType' object is not iterable", "level": "ERROR", "timestamp": "2024-12-06T13:45:06.592580", "stacktrace": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.11/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py\", line 308, in user_info\n return await _get_user_info_for_proxy_admin()\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py\", line 431, in _get_user_info_for_proxy_admin\n for key in _keys_in_db:\nTypeError: 'NoneType' object is not iterable"}
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.53.7
Twitter / LinkedIn details
No response