Error during query wheather with DuckDuckGo. #3202

Closed
opened 2025-11-11 15:25:32 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @okamototk on GitHub (Jan 6, 2025).

Bug Report

Under following condition, Open WebUI output's error and response is not expected.

condition

  • Using Web Search with DuckDuckGo
  • Send text "How was weather 1st Janualry 2025 at Tokyo?"
  • Using "hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M"

error in Open WebUI

DEBUG [open_webui.utils.middleware] form_data: {'stream': True, 'model': 'hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M', 'messages': [{'role': 'user', 'content': 'How was weather 1st Janualry 2025 at Tokyo?'}], 'features': {'web_search': True}, 'metadata': {'user_id': 'ea308e0a-3e08-4d55-8b3e-e131366c3a48', 'chat_id': '9594c3e8-77af-4cc2-9fa4-5883eeb367d4', 'message_id': '4864c313-7f97-4589-9bb6-888c43014c5f', 'session_id': 'RaHK1DfUi01n7OC0AAAF', 'tool_ids': None, 'files': None, 'features': {'web_search': True}}, 'options': {}}
DEBUG [open_webui.routers.tasks] generating web_search queries using model hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M for user toraneko@gmail.com
INFO:     192.168.127.1:0 - "POST /api/v1/tasks/auto/completions HTTP/1.1" 200 OK
INFO:     192.168.127.1:0 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK
ERROR [open_webui.routers.retrieval] _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 60, in _text_extract_json
    end = html_bytes.index(b");DDG.duckbar.load(", start)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: subsection not found

Installation Method

helm upgrade --install -nopen-webui open-webui open-webui/open-webui --version 5.1.1

Environment

  • Open WebUI Version: v0.5.4
  • Ollama: v0.5.4
  • OS: Mac Sequoia(Apple M2)
  • Browser: Chrome

Expected Behavior:

Return result for wheather query for specific date and place with Web Search.

Actual Behavior:

Doesn't return wheather result and got following error in Open WebUI logs:

DEBUG [open_webui.utils.middleware] form_data: {'stream': True, 'model': 'hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M', 'messages': [{'role': 'user', 'content': 'How was weather 1st Janualry 2025 at Tokyo?'}], 'features': {'web_search': True}, 'metadata': {'user_id': 'ea308e0a-3e08-4d55-8b3e-e131366c3a48', 'chat_id': '9594c3e8-77af-4cc2-9fa4-5883eeb367d4', 'message_id': '4864c313-7f97-4589-9bb6-888c43014c5f', 'session_id': 'RaHK1DfUi01n7OC0AAAF', 'tool_ids': None, 'files': None, 'features': {'web_search': True}}, 'options': {}}
DEBUG [open_webui.routers.tasks] generating web_search queries using model hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M for user toraneko@gmail.com
INFO:     192.168.127.1:0 - "POST /api/v1/tasks/auto/completions HTTP/1.1" 200 OK
INFO:     192.168.127.1:0 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK
ERROR [open_webui.routers.retrieval] _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 60, in _text_extract_json
    end = html_bytes.index(b");DDG.duckbar.load(", start)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: subsection not found

The above exception was the direct cause of the following exception:

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 1196, in search_web
    return search_duckduckgo(
           ^^^^^^^^^^^^^^^^^^
  File "/app/backend/open_webui/retrieval/web/duckduckgo.py", line 27, in search_duckduckgo
    ddgs_gen = ddgs.text(
               ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 243, in text
    results = self._text_api(keywords, region, safesearch, timelimit, max_results)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 330, in _text_api
    raise e
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 327, in _text_api
    for r in self._executor.map(_text_api_page, slist):
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 306, in _text_api_page
    page_data = _text_extract_json(resp_content, keywords)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 65, in _text_extract_json
    raise DuckDuckGoSearchException(f"_text_extract_json() {keywords=} {type(ex).__name__}: {ex}") from ex
duckduckgo_search.exceptions.DuckDuckGoSearchException: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found
ERROR [open_webui.utils.middleware] 400: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 60, in _text_extract_json
    end = html_bytes.index(b");DDG.duckbar.load(", start)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: subsection not found

The above exception was the direct cause of the following exception:

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 1196, in search_web
    return search_duckduckgo(
           ^^^^^^^^^^^^^^^^^^
  File "/app/backend/open_webui/retrieval/web/duckduckgo.py", line 27, in search_duckduckgo
    ddgs_gen = ddgs.text(
               ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 243, in text
    results = self._text_api(keywords, region, safesearch, timelimit, max_results)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 330, in _text_api
    raise e
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 327, in _text_api
    for r in self._executor.map(_text_api_page, slist):
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 306, in _text_api_page
    page_data = _text_extract_json(resp_content, keywords)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 65, in _text_extract_json
    raise DuckDuckGoSearchException(f"_text_extract_json() {keywords=} {type(ex).__name__}: {ex}") from ex
duckduckgo_search.exceptions.DuckDuckGoSearchException: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found

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: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found
DEBUG [open_webui.utils.middleware] tool_ids=None
Originally created by @okamototk on GitHub (Jan 6, 2025). # Bug Report Under following condition, Open WebUI output's error and response is not expected. ### condition * Using Web Search with DuckDuckGo * Send text "How was weather 1st Janualry 2025 at Tokyo?" * Using "hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M" ### error in Open WebUI ``` DEBUG [open_webui.utils.middleware] form_data: {'stream': True, 'model': 'hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M', 'messages': [{'role': 'user', 'content': 'How was weather 1st Janualry 2025 at Tokyo?'}], 'features': {'web_search': True}, 'metadata': {'user_id': 'ea308e0a-3e08-4d55-8b3e-e131366c3a48', 'chat_id': '9594c3e8-77af-4cc2-9fa4-5883eeb367d4', 'message_id': '4864c313-7f97-4589-9bb6-888c43014c5f', 'session_id': 'RaHK1DfUi01n7OC0AAAF', 'tool_ids': None, 'files': None, 'features': {'web_search': True}}, 'options': {}} DEBUG [open_webui.routers.tasks] generating web_search queries using model hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M for user toraneko@gmail.com INFO: 192.168.127.1:0 - "POST /api/v1/tasks/auto/completions HTTP/1.1" 200 OK INFO: 192.168.127.1:0 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK ERROR [open_webui.routers.retrieval] _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 60, in _text_extract_json end = html_bytes.index(b");DDG.duckbar.load(", start) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: subsection not found ``` ## Installation Method ``` helm upgrade --install -nopen-webui open-webui open-webui/open-webui --version 5.1.1 ``` ## Environment - Open WebUI Version: v0.5.4 - Ollama: v0.5.4 - OS: Mac Sequoia(Apple M2) - Browser: Chrome ## Expected Behavior: Return result for wheather query for specific date and place with Web Search. ## Actual Behavior: Doesn't return wheather result and got following error in Open WebUI logs: ``` DEBUG [open_webui.utils.middleware] form_data: {'stream': True, 'model': 'hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M', 'messages': [{'role': 'user', 'content': 'How was weather 1st Janualry 2025 at Tokyo?'}], 'features': {'web_search': True}, 'metadata': {'user_id': 'ea308e0a-3e08-4d55-8b3e-e131366c3a48', 'chat_id': '9594c3e8-77af-4cc2-9fa4-5883eeb367d4', 'message_id': '4864c313-7f97-4589-9bb6-888c43014c5f', 'session_id': 'RaHK1DfUi01n7OC0AAAF', 'tool_ids': None, 'files': None, 'features': {'web_search': True}}, 'options': {}} DEBUG [open_webui.routers.tasks] generating web_search queries using model hf.co/mradermacher/Llama-3.1-Swallow-8B-Instruct-v0.3-i1-GGUF:Q4_K_M for user toraneko@gmail.com INFO: 192.168.127.1:0 - "POST /api/v1/tasks/auto/completions HTTP/1.1" 200 OK INFO: 192.168.127.1:0 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK ERROR [open_webui.routers.retrieval] _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 60, in _text_extract_json end = html_bytes.index(b");DDG.duckbar.load(", start) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: subsection not found The above exception was the direct cause of the following exception: 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 1196, in search_web return search_duckduckgo( ^^^^^^^^^^^^^^^^^^ File "/app/backend/open_webui/retrieval/web/duckduckgo.py", line 27, in search_duckduckgo ddgs_gen = ddgs.text( ^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 243, in text results = self._text_api(keywords, region, safesearch, timelimit, max_results) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 330, in _text_api raise e File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 327, in _text_api for r in self._executor.map(_text_api_page, slist): File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 306, in _text_api_page page_data = _text_extract_json(resp_content, keywords) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 65, in _text_extract_json raise DuckDuckGoSearchException(f"_text_extract_json() {keywords=} {type(ex).__name__}: {ex}") from ex duckduckgo_search.exceptions.DuckDuckGoSearchException: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found ERROR [open_webui.utils.middleware] 400: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 60, in _text_extract_json end = html_bytes.index(b");DDG.duckbar.load(", start) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: subsection not found The above exception was the direct cause of the following exception: 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 1196, in search_web return search_duckduckgo( ^^^^^^^^^^^^^^^^^^ File "/app/backend/open_webui/retrieval/web/duckduckgo.py", line 27, in search_duckduckgo ddgs_gen = ddgs.text( ^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 243, in text results = self._text_api(keywords, region, safesearch, timelimit, max_results) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 330, in _text_api raise e File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 327, in _text_api for r in self._executor.map(_text_api_page, slist): File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 306, in _text_api_page page_data = _text_extract_json(resp_content, keywords) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/duckduckgo_search/utils.py", line 65, in _text_extract_json raise DuckDuckGoSearchException(f"_text_extract_json() {keywords=} {type(ex).__name__}: {ex}") from ex duckduckgo_search.exceptions.DuckDuckGoSearchException: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found 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: _text_extract_json() keywords='weather in Tokyo January 6th, 2025' ValueError: subsection not found DEBUG [open_webui.utils.middleware] tool_ids=None ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3202