Web search fails with SearXNG integration: Empty q parameter causes 400 error #4210

Closed
opened 2025-11-11 15:48:53 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @rogen84 on GitHub (Feb 28, 2025).

Bug Report

Description

When Open-WebUI is configured to use SearXNG as the search engine, all web search requests fail. The backend logs show a 400 BAD REQUEST error from SearXNG due to an empty q parameter in the request URL.


Steps to Reproduce

  1. Configure Open-WebUI to use SearXNG (URL: http://searxng:8080/search?q=<query>).
  2. Send a query requiring web search (e.g., "latest news").
  3. Observe backend logs for the error:
    HTTPError: 400 Client Error: BAD REQUEST for url: http://searxng:8080/search?q=&format=json&pageno=1...  
    

Expected Behavior

Open-WebUI should pass the user’s search query (e.g., "latest news") to SearXNG via the q parameter, generating a valid URL like http://searxng:8080/search?q=latest+news.


Actual Behavior

The q parameter in the SearXNG request URL is always empty (q=), resulting in a 400 error. Key log snippet:

File "/app/backend/open_webui/retrieval/web/searxng.py", line 79  
response.raise_for_status()  
requests.exceptions.HTTPError: 400 Client Error...  

Impact

  • All web search functionality via SearXNG is completely broken.
  • Users cannot retrieve real-time web results through Open-WebUI.

Environment

  • Open-WebUI Version: v0.5.18 (Docker)
  • SearXNG Configuration:
    • URL: http://searxng:8080
    • Verified working independently (e.g., http://searxng:8080/search?q=test returns valid results).

Additional Context

  • Full Error Log:
    2025-02-28 21:53:43.855 | ERROR | open_webui.routers.retrieval:process_web_search:1404 - 400 Client Error: BAD REQUEST for url: http://searxng:8080/search?q=&format=json...  
    

Originally created by @rogen84 on GitHub (Feb 28, 2025). # Bug Report ### **Description** When Open-WebUI is configured to use SearXNG as the search engine, all web search requests fail. The backend logs show a `400 BAD REQUEST` error from SearXNG due to an empty `q` parameter in the request URL. --- ### **Steps to Reproduce** 1. Configure Open-WebUI to use SearXNG (URL: `http://searxng:8080/search?q=<query>`). 2. Send a query requiring web search (e.g., "latest news"). 3. Observe backend logs for the error: ```bash HTTPError: 400 Client Error: BAD REQUEST for url: http://searxng:8080/search?q=&format=json&pageno=1... ``` --- ### **Expected Behavior** Open-WebUI should pass the user’s search query (e.g., `"latest news"`) to SearXNG via the `q` parameter, generating a valid URL like `http://searxng:8080/search?q=latest+news`. --- ### **Actual Behavior** The `q` parameter in the SearXNG request URL is always empty (`q=`), resulting in a `400` error. Key log snippet: ```python File "/app/backend/open_webui/retrieval/web/searxng.py", line 79 response.raise_for_status() requests.exceptions.HTTPError: 400 Client Error... ``` --- ### **Impact** - **All web search functionality** via SearXNG is completely broken. - Users cannot retrieve real-time web results through Open-WebUI. --- ### **Environment** - **Open-WebUI Version**: v0.5.18 (Docker) - **SearXNG Configuration**: - URL: `http://searxng:8080` - Verified working independently (e.g., `http://searxng:8080/search?q=test` returns valid results). --- ### **Additional Context** - **Full Error Log**: ```python 2025-02-28 21:53:43.855 | ERROR | open_webui.routers.retrieval:process_web_search:1404 - 400 Client Error: BAD REQUEST for url: http://searxng:8080/search?q=&format=json... ``` ---
Author
Owner

@rgaricano commented on GitHub (Feb 28, 2025):

do you added "- json" to your searxng settings.yml?

  formats:
    - html
    - json

&
could you test with http://searxng:8080/searxng/search?q=<query> as searxng URL on openwebui search settings?

@rgaricano commented on GitHub (Feb 28, 2025): do you added "- json" to your searxng settings.yml? ``` formats: - html - json ``` & could you test with `http://searxng:8080/searxng/search?q=<query> ` as searxng URL on openwebui search settings?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#4210