From 36522bbbb6c63ba9587deabc33aa4d5be1d97b67 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:25:36 +0100 Subject: [PATCH] fix: connection check shows Network Problem instead of the real error (#35346) Verifying an Anthropic or Ollama connection with a wrong API key showed only "OpenAI: Network Problem" or "Ollama: Network Problem", while the actual reason from the provider was there but got lost. The toast now shows the provider's error, and OpenAI-compatible connections still show theirs. Fixes #35345 --- backend/open_webui/routers/openai.py | 2 ++ src/lib/apis/ollama/index.ts | 2 +- src/lib/apis/openai/index.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index 2041378370..b181a8b39a 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -1117,6 +1117,8 @@ async def verify_connection( # ClientError covers all aiohttp requests issues log.exception(f'Client error: {str(e)}') raise HTTPException(status_code=500, detail=ERROR_MESSAGES.SERVER_CONNECTION_ERROR) + except HTTPException: + raise except Exception as e: log.exception(f'Unexpected error: {e}') raise HTTPException(status_code=500, detail=ERROR_MESSAGES.SERVER_CONNECTION_ERROR) diff --git a/src/lib/apis/ollama/index.ts b/src/lib/apis/ollama/index.ts index 6ce2ea4c14..9683c91b48 100644 --- a/src/lib/apis/ollama/index.ts +++ b/src/lib/apis/ollama/index.ts @@ -19,7 +19,7 @@ export const verifyOllamaConnection = async (token: string = '', connection: dic return res.json(); }) .catch((err) => { - error = `Ollama: ${err?.error?.message ?? 'Network Problem'}`; + error = `Ollama: ${err?.detail ?? err?.error?.message ?? 'Network Problem'}`; return []; }); diff --git a/src/lib/apis/openai/index.ts b/src/lib/apis/openai/index.ts index 703de3fe01..40aa5bbf6b 100644 --- a/src/lib/apis/openai/index.ts +++ b/src/lib/apis/openai/index.ts @@ -333,7 +333,7 @@ export const verifyOpenAIConnection = async ( return res.json(); }) .catch((err) => { - error = `OpenAI: ${err?.error?.message ?? 'Network Problem'}`; + error = `OpenAI: ${err?.detail ?? err?.error?.message ?? 'Network Problem'}`; return []; });