fastapi.exceptions.HTTPException: 400: No search engine API key found in environment variables #3189

Closed
opened 2025-11-11 15:25:17 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @gamersalpha on GitHub (Jan 4, 2025).

Hello so i got a searxng installed ni docker with this docker compose :

services:
  swag:
    container_name: searxng
    image: searxng/searxng
    ports:
      - 8080:8080
    volumes:
      - /volume1/docker/searx/:/etc/searxng
    restart: unless-stopped
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"
    environment:
      - PUID=1000
      - PGID=1000
      - BASE_URL=https://searx.domaine.fr
      - INSTANCE_NAME=LocalSearch
      - TZ=Europe/Paris
      - ENABLE_RAG_WEB_SEARCH=True
      - RAG_WEB_SEARCH_ENGINE="searxng"
      - RAG_WEB_SEARCH_RESULT_COUNT=3
      - RAG_WEB_SEARCH_CONCURRENT_REQUESTS=10
      - SEARXNG_QUERY_URL="https://searx..domaine.fr/search?q=<query>"`
     ``` 
            
      And i m using OpenWebUI to make search 
      
      ![image](https://github.com/user-attachments/assets/cb863b69-8d29-4726-9e06-6317d1f6b1c2)

andi got this error in log : 

```/app/backend/open_webui

/app/backend
/app
Running migrations
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [open_webui.env] 'DEFAULT_LOCALE' loaded from the latest database entry
INFO  [open_webui.env] 'DEFAULT_PROMPT_SUGGESTIONS' loaded from the latest database entry
WARNI [open_webui.env] 
WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS.
INFO  [open_webui.env] Embedding model set: sentence-transformers/all-MiniLM-L6-v2
WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests.
  ___                    __        __   _     _   _ ___
 / _ \ _ __   ___ _ __   \ \      / /__| |__ | | | |_ _|
| | | | '_ \ / _ \ '_ \   \ \ /\ / / _ \ '_ \| | | || |
| |_| | |_) |  __/ | | |   \ V  V /  __/ |_) | |_| || |
 \___/| .__/ \___|_| |_|    \_/\_/ \___|_.__/ \___/|___|

|
v0.5.3 - building the best open-source AI user interface.
https://github.com/open-webui/open-webui

Fetching 30 files:   0%|          | 0/30 [00:00<?, ?it/s]
Fetching 30 files: 100%|██████████| 30/30 [00:00<00:00, 148558.58it/s]
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO:     ('192.168.1.11', 0) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted]
INFO:     connection open
INFO:     ('192.168.1.11', 0) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted]
INFO:     connection open
INFO:     192.168.1.11:0 - "GET /favicon/apple-touch-icon.png HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /c/75338103-afc9-4f27-8a2c-01c76b92a9e6 HTTP/1.1" 200 OK
INFO:     connection closed
INFO:     192.168.1.11:0 - "GET /api/config HTTP/1.1" 200 OK
INFO:     ('192.168.1.11', 0) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted]
INFO:     connection open
INFO:     192.168.1.11:0 - "GET /api/v1/auths/ HTTP/1.1" 401 Unauthorized
INFO  [open_webui.env] Saving 'ENABLE_SIGNUP' to the database
INFO  [open_webui.models.auths] insert_new_auth
INFO:     192.168.1.11:0 - "POST /api/v1/auths/signup HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/config HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/changelog HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK
INFO  [open_webui.routers.openai] get_all_models()
INFO  [open_webui.routers.ollama] get_all_models()
INFO:     192.168.1.11:0 - "GET /api/models HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/configs/banners HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/tools/ HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/version/updates HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/channels/ HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/chats/pinned HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/folders/ HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/chats/?page=2 HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "POST /api/v1/users/user/settings/update HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "POST /api/v1/chats/new HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "POST /api/v1/chats/bb995122-7989-4f74-aea5-3c9de26d49bb HTTP/1.1" 200 OK
INFO:     192.168.1.11:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
ERROR [open_webui.routers.retrieval] No search engine API key found in environment variables
Traceback (most recent call last):
  File "/app/backend/open_webui/routers/retrieval.py", line 1248, in process_web_search
    web_results = search_web(
                  ^^^^^^^^^^^
  File "/app/backend/open_webui/routers/retrieval.py", line 1237, in search_web
    raise Exception("No search engine API key found in environment variables")
Exception: No search engine API key found in environment variables
ERROR [open_webui.utils.middleware] 400: No search engine API key found in environment variables
Traceback (most recent call last):
  File "/app/backend/open_webui/routers/retrieval.py", line 1248, in process_web_search
    web_results = search_web(
                  ^^^^^^^^^^^
  File "/app/backend/open_webui/routers/retrieval.py", line 1237, in search_web
    raise Exception("No search engine API key found in environment variables")
Exception: No search engine API key found in environment variables
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/backend/open_webui/utils/middleware.py", line 421, 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 423, in <lambda>
    lambda: process_web_search(
            ^^^^^^^^^^^^^^^^^^^
  File "/app/backend/open_webui/routers/retrieval.py", line 1254, in process_web_search
    raise HTTPException(
fastapi.exceptions.HTTPException: 400: No search engine API key found in environment variables`

What do u think is wrong please ?

Originally created by @gamersalpha on GitHub (Jan 4, 2025). Hello so i got a searxng installed ni docker with this docker compose : ``` services: swag: container_name: searxng image: searxng/searxng ports: - 8080:8080 volumes: - /volume1/docker/searx/:/etc/searxng restart: unless-stopped cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID - DAC_OVERRIDE logging: driver: "json-file" options: max-size: "1m" max-file: "1" environment: - PUID=1000 - PGID=1000 - BASE_URL=https://searx.domaine.fr - INSTANCE_NAME=LocalSearch - TZ=Europe/Paris - ENABLE_RAG_WEB_SEARCH=True - RAG_WEB_SEARCH_ENGINE="searxng" - RAG_WEB_SEARCH_RESULT_COUNT=3 - RAG_WEB_SEARCH_CONCURRENT_REQUESTS=10 - SEARXNG_QUERY_URL="https://searx..domaine.fr/search?q=<query>"` ``` And i m using OpenWebUI to make search ![image](https://github.com/user-attachments/assets/cb863b69-8d29-4726-9e06-6317d1f6b1c2) andi got this error in log : ```/app/backend/open_webui  /app/backend /app Running migrations INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [open_webui.env] 'DEFAULT_LOCALE' loaded from the latest database entry INFO [open_webui.env] 'DEFAULT_PROMPT_SUGGESTIONS' loaded from the latest database entry WARNI [open_webui.env] WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS. INFO [open_webui.env] Embedding model set: sentence-transformers/all-MiniLM-L6-v2 WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests. ___ __ __ _ _ _ ___ / _ \ _ __ ___ _ __ \ \ / /__| |__ | | | |_ _| | | | | '_ \ / _ \ '_ \ \ \ /\ / / _ \ '_ \| | | || | | |_| | |_) | __/ | | | \ V V / __/ |_) | |_| || | \___/| .__/ \___|_| |_| \_/\_/ \___|_.__/ \___/|___|  | v0.5.3 - building the best open-source AI user interface. https://github.com/open-webui/open-webui Fetching 30 files: 0%| | 0/30 [00:00<?, ?it/s] Fetching 30 files: 100%|██████████| 30/30 [00:00<00:00, 148558.58it/s] INFO: Started server process [1] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit) INFO: ('192.168.1.11', 0) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted] INFO: connection open INFO: ('192.168.1.11', 0) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted] INFO: connection open INFO: 192.168.1.11:0 - "GET /favicon/apple-touch-icon.png HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /c/75338103-afc9-4f27-8a2c-01c76b92a9e6 HTTP/1.1" 200 OK INFO: connection closed INFO: 192.168.1.11:0 - "GET /api/config HTTP/1.1" 200 OK INFO: ('192.168.1.11', 0) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted] INFO: connection open INFO: 192.168.1.11:0 - "GET /api/v1/auths/ HTTP/1.1" 401 Unauthorized INFO [open_webui.env] Saving 'ENABLE_SIGNUP' to the database INFO [open_webui.models.auths] insert_new_auth INFO: 192.168.1.11:0 - "POST /api/v1/auths/signup HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/config HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/changelog HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK INFO [open_webui.routers.openai] get_all_models() INFO [open_webui.routers.ollama] get_all_models() INFO: 192.168.1.11:0 - "GET /api/models HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/configs/banners HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/tools/ HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/version/updates HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/channels/ HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /ollama/api/version HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/chats/pinned HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/folders/ HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/chats/?page=2 HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "POST /api/v1/users/user/settings/update HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "POST /api/v1/chats/new HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "POST /api/v1/chats/bb995122-7989-4f74-aea5-3c9de26d49bb HTTP/1.1" 200 OK INFO: 192.168.1.11:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK ERROR [open_webui.routers.retrieval] No search engine API key found in environment variables Traceback (most recent call last): File "/app/backend/open_webui/routers/retrieval.py", line 1248, in process_web_search web_results = search_web( ^^^^^^^^^^^ File "/app/backend/open_webui/routers/retrieval.py", line 1237, in search_web raise Exception("No search engine API key found in environment variables") Exception: No search engine API key found in environment variables ERROR [open_webui.utils.middleware] 400: No search engine API key found in environment variables Traceback (most recent call last): File "/app/backend/open_webui/routers/retrieval.py", line 1248, in process_web_search web_results = search_web( ^^^^^^^^^^^ File "/app/backend/open_webui/routers/retrieval.py", line 1237, in search_web raise Exception("No search engine API key found in environment variables") Exception: No search engine API key found in environment variables During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/backend/open_webui/utils/middleware.py", line 421, 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 423, in <lambda> lambda: process_web_search( ^^^^^^^^^^^^^^^^^^^ File "/app/backend/open_webui/routers/retrieval.py", line 1254, in process_web_search raise HTTPException( fastapi.exceptions.HTTPException: 400: No search engine API key found in environment variables` ``` What do u think is wrong please ?
Author
Owner

@tjbck commented on GitHub (Jan 5, 2025):

Means RAG_WEB_SEARCH_ENGINE isn't set for some reason, try saving the web search config from the ui again and keep us updated!

@tjbck commented on GitHub (Jan 5, 2025): Means `RAG_WEB_SEARCH_ENGINE` isn't set for some reason, try saving the web search config from the ui again and keep us updated!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3189