From 6faf5403103dbf6acfa5eb572f3332c5808c6de1 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sat, 10 Oct 2026 18:00:51 +0200 Subject: [PATCH] fix: show the speech engine's reason when it refuses a transcription (#32186) When an OpenAI-compatible speech-to-text engine or Deepgram rejected a recording, the error shown after dictating only gave the HTTP status, such as "429 Too Many Requests", and the engine's own reason, such as "Quota exceeded" or "Invalid credentials.", was lost. The error now shows that reason. When the engine sends no reason, the HTTP status is shown as before. Fixes #32009 --- backend/open_webui/routers/audio/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/routers/audio/__init__.py b/backend/open_webui/routers/audio/__init__.py index e92f27a8ff..eb0d0456e8 100644 --- a/backend/open_webui/routers/audio/__init__.py +++ b/backend/open_webui/routers/audio/__init__.py @@ -941,6 +941,8 @@ async def _transcribe_openai(request, file_path, filename, languages, file_dir, if r.status == 200: break + # raise_for_status releases the response, so read the error body first + await r.read() r.raise_for_status() data = await r.json() @@ -955,6 +957,8 @@ async def _transcribe_openai(request, file_path, filename, languages, file_dir, res = await r.json() if 'error' in res: detail = f'External: {res["error"].get("message", "")}' + else: + detail = f'External: {e}' except Exception: detail = f'External: {e}' # LICENSE covers this Open WebUI error identifier. @@ -993,6 +997,7 @@ async def _transcribe_deepgram(request, file_path, languages, file_dir, id): if r.status == 200: break + await r.read() r.raise_for_status() body = await r.json() @@ -1021,9 +1026,11 @@ async def _transcribe_deepgram(request, file_path, languages, file_dir, id): res.get('error', {}).get('message', '') if isinstance(res.get('error'), dict) else str(res.get('error', '')) - ) + ) or res.get('err_msg', '') if msg: detail = f'External: {msg}' + else: + detail = f'External: {e}' except Exception: detail = f'External: {e}' raise Exception(detail)