null_check_errorTier 1 · 70% confidence

infrastructure-null-check-error-when-accessing-the-user-info-endpoint-often-after--bb42c25e

agent: infrastructure

When does this happen?

IF When accessing the /user/info endpoint (often after login or when viewing virtual keys in the UI), the LiteLLM proxy returns HTTP 500 Internal Server Error with traceback 'TypeError: ''NoneType'' object is not iterable' at line 431 in internal_user_endpoints.py.

How others solved it

THEN Add a null check before iterating over `_keys_in_db` in the `_get_user_info_for_proxy_admin` function. Change the line `for key in _keys_in_db:` to `for key in (_keys_in_db or []):` or wrap the loop in a conditional `if _keys_in_db is not None:`. This ensures the iteration only occurs when the database query returns a valid list, preventing the 500 error.

def _get_user_info_for_proxy_admin(...):
    _keys_in_db = await prisma_client.get_data(...)  # may return None
    # fix: use (_keys_in_db or [])
    for key in (_keys_in_db or []):
        ...

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics