From b1bd37ad0eff46a74e3fc88092f0f9273b3fa835 Mon Sep 17 00:00:00 2001 From: osalloum <100945640+osalloum@users.noreply.github.com> Date: Wed, 26 Aug 2026 10:47:08 +0200 Subject: [PATCH] fix: avoid SQLite int overflow when matching numeric OAuth sub Google subs are 21 digits, which is larger than SQLite's max INTEGER (2**63-1), so binding int(sub) raises OverflowError and every login fails. Only take the int comparison branch when the value actually fits. --- backend/open_webui/models/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/models/users.py b/backend/open_webui/models/users.py index 3d132c529e..b85cebd583 100644 --- a/backend/open_webui/models/users.py +++ b/backend/open_webui/models/users.py @@ -366,7 +366,7 @@ class UsersTable: sub_expr = User.oauth[provider]['sub'].as_string() query = select(User).where(sub_expr == sub) # SQLite preserves JSON numeric type here; Postgres ->> already compares numeric JSON as text. - if session.get_bind().dialect.name == 'sqlite' and sub.isdecimal(): + if session.get_bind().dialect.name == 'sqlite' and sub.isdecimal() and int(sub) <= 2**63 - 1: query = select(User).where(or_(sub_expr == sub, sub_expr == int(sub))) row = (await session.execute(query)).scalars().first() return UserModel.model_validate(row) if row else None