From f4670b3add732e27fb4fb259dc9887d71146b1e3 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 31 Dec 2025 14:39:22 +0100 Subject: [PATCH] fix: prevent get_user_ids_from_room crash on missing session (#20271) Add null check in list comprehension before accessing session['id']. When a session_id exists in the room but has been removed from SESSION_POOL, the function now skips it instead of crashing with TypeError. --- backend/open_webui/socket/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index 72b2761c6..ec5915663 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -246,7 +246,11 @@ def get_user_ids_from_room(room): active_session_ids = get_session_ids_from_room(room) active_user_ids = list( - set([SESSION_POOL.get(session_id)["id"] for session_id in active_session_ids]) + set([ + SESSION_POOL.get(session_id)["id"] + for session_id in active_session_ids + if SESSION_POOL.get(session_id) is not None + ]) ) return active_user_ids