diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py index b7d70d7509..fb64e51947 100644 --- a/backend/open_webui/routers/retrieval.py +++ b/backend/open_webui/routers/retrieval.py @@ -2670,7 +2670,12 @@ async def process_web_search(request: Request, form_data: SearchForm, user=Depen user=user, ) except Exception as e: - log.debug(f'error saving docs: {e}') + # Surface the failure instead of returning an unusable collection + log.exception(f'Error saving web search results to vector DB: {e}') + raise HTTPException( + status.HTTP_500_INTERNAL_SERVER_ERROR, + detail='Failed to embed and store the retrieved web pages. Check the embedding configuration in Admin Settings > Documents.', + ) return { 'status': True, diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 1fade157f8..be87d1c1ee 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1497,12 +1497,13 @@ async def chat_web_search_handler(request: Request, form_data: dict, extra_param except Exception as e: log.exception(e) + detail = e.detail if isinstance(e, HTTPException) else None await event_emitter( { 'type': 'status', 'data': { 'action': 'web_search', - 'description': 'An error occurred while searching the web', + 'description': (str(detail) if detail else 'An error occurred while searching the web'), 'queries': queries, 'done': True, 'error': True,