From 810f2ddd8a2403bea0b0b7b158ff1f6f4cc5f764 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:45:22 +0100 Subject: [PATCH] fix: startup logs an invalid OAuth client error for MCP servers that were never registered (#34938) An OAuth 2.1 MCP tool server that had not gone through Register Client yet logged "Stored OAuth client data is invalid; reconnect this tool server" on every startup, even though nothing was stored. Such a server is now skipped at startup, the same way it is skipped when a user connects, so the log stays quiet until it is registered. Client data that cannot be read, for example after the encryption key changed, is still reported. Relates to #34937 --- backend/open_webui/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 89c9d48b37..3d8317fa63 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -653,8 +653,9 @@ async def initialize_runtime_config(app: FastAPI): if tool_server_connection.get('type', 'openapi') == 'mcp': server_id = (tool_server_connection.get('info') or {}).get('id') auth_type = tool_server_connection.get('auth_type', 'none') + oauth_client_info = (tool_server_connection.get('info') or {}).get('oauth_client_info', '') - if server_id and auth_type in ('oauth_2.1', 'oauth_2.1_static'): + if server_id and auth_type in ('oauth_2.1', 'oauth_2.1_static') and oauth_client_info: try: oauth_client_info = resolve_oauth_client_info(tool_server_connection) oauth_client_info = await recover_oauth_client_metadata(tool_server_connection, oauth_client_info)