[GH-ISSUE #9995] web search using searxng: No search query generated #15725

Closed
opened 2026-04-19 21:52:44 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @water2004 on GitHub (Feb 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9995

Bug Report

Installation Method

I install open-webui using docker without ollama

docker run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main

And then install searxng using docker compose, docker-compose.yml is shown as below

version: "3.7"

services:
  redis:
    container_name: redis
    image: docker.1ms.run/valkey/valkey:8-alpine
    command: valkey-server --save 30 1 --loglevel warning
    restart: unless-stopped
    networks:
      - searxng
    volumes:
      - valkey-data2:/data
    cap_drop:
      - ALL
    cap_add:
      - SETGID
      - SETUID
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"

  searxng:
    container_name: searxng
    image: docker.1ms.run/searxng/searxng:latest
    restart: unless-stopped
    networks:
      - searxng
    ports:
      - "0.0.0.0:8080:8080"
    volumes:
      - ./searxng:/etc/searxng:rw
    environment:
      - SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
      - UWSGI_WORKERS=${SEARXNG_UWSGI_WORKERS:-4}
      - UWSGI_THREADS=${SEARXNG_UWSGI_THREADS:-4}
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"

networks:
  searxng:

volumes:
  caddy-data:
  caddy-config:
  valkey-data2:

settings.yml

# see https://docs.searxng.org/admin/settings/settings.html#settings-use-default-settings
use_default_settings:
  engines:
    keep_only:
      - bing
server:
  # base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml
  secret_key: "***"  # change this!
  limiter: false  # can be disabled for a private instance
  image_proxy: true
ui:
  static_use_hash: true
redis:
  url: redis://redis:6379/0
search:
  formats:
    - json
engines:
  - name: bing
    disabled: false

admin panel settings:

Image

Environment

  • Open WebUI Version: latest

  • Ollama (if applicable): not installed

  • Operating System: host: ubuntu22.04

  • Browser (if applicable): latest edge on Windows10

Confirmation:

  • [x ] I have read and followed all the instructions provided in the README.md.
  • [ x] I am on the latest version of both Open WebUI and Ollama.
  • [x ] I have included the Docker container logs.
  • [x ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Behavior:

Firstly, it comes out "Error searching "

Image

the logs show that the query string is empty

Traceback (most recent call last):
  File "/app/backend/open_webui/utils/middleware.py", line 340, in chat_web_search_handler
    results = await loop.run_in_executor(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/open_webui/utils/middleware.py", line 342, in <lambda>
    lambda: process_web_search(
            ^^^^^^^^^^^^^^^^^^^
  File "/app/backend/open_webui/routers/retrieval.py", line 1324, in process_web_search
    raise HTTPException(
fastapi.exceptions.HTTPException: 400: 400 Client Error: BAD REQUEST for url: http://172.17.0.1:8080/search?q=&q=&format=json&pageno=1&safesearch=1&language=en-US&time_range=&categories=&theme=simple&image_proxy=0

log of searxng:

2025-02-14 10:24:12,076 WARNING:searx.engines.bing: ErrorContext('searx/search/processors/online.py', 125, 'count_error(', None, '1 redirects, maximum: 0', ('200', 'OK', 'cn.bing.com')) True

after several tries, it comes out "No search query generated", and there are no logs from open-webui or searxng

Image

Originally created by @water2004 on GitHub (Feb 14, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/9995 # Bug Report ## Installation Method I install open-webui using docker without ollama ```sh docker run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main ``` And then install searxng using docker compose, `docker-compose.yml` is shown as below ```yml version: "3.7" services: redis: container_name: redis image: docker.1ms.run/valkey/valkey:8-alpine command: valkey-server --save 30 1 --loglevel warning restart: unless-stopped networks: - searxng volumes: - valkey-data2:/data cap_drop: - ALL cap_add: - SETGID - SETUID - DAC_OVERRIDE logging: driver: "json-file" options: max-size: "1m" max-file: "1" searxng: container_name: searxng image: docker.1ms.run/searxng/searxng:latest restart: unless-stopped networks: - searxng ports: - "0.0.0.0:8080:8080" volumes: - ./searxng:/etc/searxng:rw environment: - SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/ - UWSGI_WORKERS=${SEARXNG_UWSGI_WORKERS:-4} - UWSGI_THREADS=${SEARXNG_UWSGI_THREADS:-4} cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID - DAC_OVERRIDE logging: driver: "json-file" options: max-size: "1m" max-file: "1" networks: searxng: volumes: caddy-data: caddy-config: valkey-data2: ``` `settings.yml` ```yml # see https://docs.searxng.org/admin/settings/settings.html#settings-use-default-settings use_default_settings: engines: keep_only: - bing server: # base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml secret_key: "***" # change this! limiter: false # can be disabled for a private instance image_proxy: true ui: static_use_hash: true redis: url: redis://redis:6379/0 search: formats: - json engines: - name: bing disabled: false ``` admin panel settings: ![Image](https://github.com/user-attachments/assets/7f0e0dfd-b894-48c6-b0aa-211b1eedcde8) ## Environment - **Open WebUI Version:** latest - **Ollama (if applicable):** not installed - **Operating System:** host: ubuntu22.04 - **Browser (if applicable):** latest edge on Windows10 **Confirmation:** - [x ] I have read and followed all the instructions provided in the README.md. - [ x] I am on the latest version of both Open WebUI and Ollama. - [x ] I have included the Docker container logs. - [x ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Behavior: Firstly, it comes out "Error searching " ![Image](https://github.com/user-attachments/assets/cbb01c22-be7f-49a1-9dbc-e6e5ca3d6e09) the logs show that the query string is empty ```sh Traceback (most recent call last): File "/app/backend/open_webui/utils/middleware.py", line 340, in chat_web_search_handler results = await loop.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/open_webui/utils/middleware.py", line 342, in <lambda> lambda: process_web_search( ^^^^^^^^^^^^^^^^^^^ File "/app/backend/open_webui/routers/retrieval.py", line 1324, in process_web_search raise HTTPException( fastapi.exceptions.HTTPException: 400: 400 Client Error: BAD REQUEST for url: http://172.17.0.1:8080/search?q=&q=&format=json&pageno=1&safesearch=1&language=en-US&time_range=&categories=&theme=simple&image_proxy=0 ``` log of searxng: ```sh 2025-02-14 10:24:12,076 WARNING:searx.engines.bing: ErrorContext('searx/search/processors/online.py', 125, 'count_error(', None, '1 redirects, maximum: 0', ('200', 'OK', 'cn.bing.com')) True ``` after several tries, it comes out "No search query generated", and there are no logs from open-webui or searxng ![Image](https://github.com/user-attachments/assets/d646eb51-b088-4551-a32f-d5819842d23b)
Author
Owner

@water2004 commented on GitHub (Feb 14, 2025):

searxng works well, I can get the result json file by browser
url: ***:8080/search?q=weather&format=json

{
    "query": "weather",
    "number_of_results": 967000,
    "results": [
        {
            "url": "https://weather.com/zh-CN/weather/tenday/l/Wuzhong+District+Jiangsu?canonicalCityId=0762a5370890acd0ad64a8a8ac38a34a9804847a9eecf1e8d33f2cc4bfdbb2d5",
            "title": "吴中区, 江苏省 10 天天气预报 - The Weather Channel",
            "content": "2024年5月10日 · 准备好获悉最精确的吴中区, 江苏省 10 天预报,包括最高温度、最低温度和降水几率 - 尽在 The Weather Channel 和 Weather.com 您的隐私 为了个性化产品 ...",
            "engine": "bing",
            "template": "default.html",
            "parsed_url": [
                "https",
                "weather.com",
                "/zh-CN/weather/tenday/l/Wuzhong+District+Jiangsu",
                "",
                "canonicalCityId=0762a5370890acd0ad64a8a8ac38a34a9804847a9eecf1e8d33f2cc4bfdbb2d5",
                ""
            ],
            "engines": [
                "bing"
            ],
            "positions": [
                1
            ],
            "score": 1,
            "category": "general"
       ...
}
<!-- gh-comment-id:2659016055 --> @water2004 commented on GitHub (Feb 14, 2025): searxng works well, I can get the result json file by browser url: `***:8080/search?q=weather&format=json` ```json { "query": "weather", "number_of_results": 967000, "results": [ { "url": "https://weather.com/zh-CN/weather/tenday/l/Wuzhong+District+Jiangsu?canonicalCityId=0762a5370890acd0ad64a8a8ac38a34a9804847a9eecf1e8d33f2cc4bfdbb2d5", "title": "吴中区, 江苏省 10 天天气预报 - The Weather Channel", "content": "2024年5月10日 · 准备好获悉最精确的吴中区, 江苏省 10 天预报,包括最高温度、最低温度和降水几率 - 尽在 The Weather Channel 和 Weather.com 您的隐私 为了个性化产品 ...", "engine": "bing", "template": "default.html", "parsed_url": [ "https", "weather.com", "/zh-CN/weather/tenday/l/Wuzhong+District+Jiangsu", "", "canonicalCityId=0762a5370890acd0ad64a8a8ac38a34a9804847a9eecf1e8d33f2cc4bfdbb2d5", "" ], "engines": [ "bing" ], "positions": [ 1 ], "score": 1, "category": "general" ... } ```
Author
Owner

@Mavyre commented on GitHub (Feb 14, 2025):

This happens when the reponse generated by the LLM isn't correctly formatted as required by the web search (should be an array of queries). This error depends on the model used and its ability to respect its system prompt.

<!-- gh-comment-id:2659711871 --> @Mavyre commented on GitHub (Feb 14, 2025): This happens when the reponse generated by the LLM isn't correctly formatted as required by the web search (should be an array of queries). This error depends on the model used and its ability to respect its system prompt.
Author
Owner

@technofox01 commented on GitHub (Feb 14, 2025):

This happens when the reponse generated by the LLM isn't correctly formatted as required by the web search (should be an array of queries). This error depends on the model used and its ability to respect its system prompt.

I am having this exact issue and continue to get this error message (even though it will show that it received three search results):

SyntaxError: The string did not match the expected pattern.

I had no issues until after 5.9. I have no idea what go broken but it is definitely on OpenWebUI’s side and not Searxng because I have tested the API outside of OpenWebUI without issue.

<!-- gh-comment-id:2659772439 --> @technofox01 commented on GitHub (Feb 14, 2025): > This happens when the reponse generated by the LLM isn't correctly formatted as required by the web search (should be an array of queries). This error depends on the model used and its ability to respect its system prompt. I am having this exact issue and continue to get this error message (even though it will show that it received three search results): SyntaxError: The string did not match the expected pattern. I had no issues until after 5.9. I have no idea what go broken but it is definitely on OpenWebUI’s side and not Searxng because I have tested the API outside of OpenWebUI without issue.
Author
Owner

@IndigoFloyd commented on GitHub (Feb 14, 2025):

Also here. However, I could not confirm whether SearXNG or Open WebUI goes wrong. If I run http://searxng:8080/search?q=hello&format=json, it returns:

{
  "query": "hello",
  "number_of_results": 0,
  "results": [
    {
      "title": "HELLO | English meaning - Cambridge Dictionary",
      "url": "https://dictionary.cambridge.org/dictionary/english/hello",
      "content": "Learn the meaning and usage of the word hello in English, with synonyms, pronunciation, and translations. Find out how to say hello in different situations, such as greeting someone, answering the phone, or attracting attention.",
      "engine": "duckduckgo",
      "template": "default.html",
      "parsed_url": [
        "https",
        "dictionary.cambridge.org",
        "/dictionary/english/hello",
        "",
        "",
        ""
      ],
...

It's weird because there are exactly some results while number_of_results is 0. But it seems not to be a fatal bug as https://github.com/searxng/searxng/issues/2457 just discussed.
My Open WebUI and SearXNG docker instances run on WSL2. Expecting for any helpful fixes or anwsers.

<!-- gh-comment-id:2659872974 --> @IndigoFloyd commented on GitHub (Feb 14, 2025): Also here. However, I could not confirm whether SearXNG or Open WebUI goes wrong. If I run `http://searxng:8080/search?q=hello&format=json`, it returns: ``` { "query": "hello", "number_of_results": 0, "results": [ { "title": "HELLO | English meaning - Cambridge Dictionary", "url": "https://dictionary.cambridge.org/dictionary/english/hello", "content": "Learn the meaning and usage of the word hello in English, with synonyms, pronunciation, and translations. Find out how to say hello in different situations, such as greeting someone, answering the phone, or attracting attention.", "engine": "duckduckgo", "template": "default.html", "parsed_url": [ "https", "dictionary.cambridge.org", "/dictionary/english/hello", "", "", "" ], ... ``` It's weird because there are exactly some results while `number_of_results` is `0`. But it seems not to be a fatal bug as [https://github.com/searxng/searxng/issues/2457](url) just discussed. My Open WebUI and SearXNG docker instances run on WSL2. Expecting for any helpful fixes or anwsers.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#15725