Skip to content

issue: Web Search with BRAVE API does not work. #20003

@tigran123

Description

@tigran123

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Pip Install

Open WebUI Version

0.6.41

Ollama Version (if applicable)

0.12.10

Operating System

Ubuntu Linux 22.04.5

Browser (if applicable)

Chrome 142.0.7444.175 (Official Build) (64-bit)

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Web search should provide results.

Actual Behavior

It does not.

Steps to Reproduce

  1. Select any model, capable of web search (e.g. paid gpt-5.2 or free groq/compound)
  2. Give a query like "Give me the list of fresh news using web search"
  3. Observe that it fails with the error shown in the log section below:

Logs & Screenshots

2025-12-17 09:45:56.859 | ERROR    | open_webui.utils.middleware:chat_web_search_handler:606 - 'JSONResponse' object is not subscriptable
Traceback (most recent call last):

  File "/home/tigran/.local/bin/open-webui", line 8, in <module>
    sys.exit(app())
    │   │    └ <typer.main.Typer object at 0x7f5e7fc00860>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/main.py", line 309, in __call__
    return get_command(self)(*args, **kwargs)
           │           │      │       └ {}
           │           │      └ ()
           │           └ <typer.main.Typer object at 0x7f5e7fc00860>
           └ <function get_command at 0x7f5e7f235760>
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ ()
           │    └ <function TyperGroup.main at 0x7f5e7f233f60>
           └ <TyperGroup >
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/core.py", line 723, in main
    return _main(
           └ <function _main at 0x7f5e7f232fc0>
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/core.py", line 193, in _main
    rv = self.invoke(ctx)
         │    │      └ <click.core.Context object at 0x7f5e7ea728d0>
         │    └ <function Group.invoke at 0x7f5e7f965580>
         └ <TyperGroup >
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
           │               │       │       │      └ <click.core.Context object at 0x7f5e7fc10da0>
           │               │       │       └ <function Command.invoke at 0x7f5e7f964360>
           │               │       └ <TyperCommand serve>
           │               └ <click.core.Context object at 0x7f5e7fc10da0>
           └ <function Group.invoke.<locals>._process_result at 0x7f5e7e82aa20>
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'host': '0.0.0.0', 'port': 8080}
           │   │      │    │           └ <click.core.Context object at 0x7f5e7fc10da0>
           │   │      │    └ <function serve at 0x7f5e7e82a840>
           │   │      └ <TyperCommand serve>
           │   └ <function Context.invoke at 0x7f5e7f95b560>
           └ <click.core.Context object at 0x7f5e7fc10da0>
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 794, in invoke
    return callback(*args, **kwargs)
           │         │       └ {'host': '0.0.0.0', 'port': 8080}
           │         └ ()
           └ <function serve at 0x7f5e7e82a840>
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/main.py", line 692, in wrapper
    return callback(**use_params)
           │          └ {'host': '0.0.0.0', 'port': 8080}
           └ <function serve at 0x7f5e7e933240>
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/__init__.py", line 78, in serve
    uvicorn.run(
    │       └ <function run at 0x7f5e7eabf420>
    └ <module 'uvicorn' from '/home/tigran/.local/lib/python3.12/site-packages/uvicorn/__init__.py'>
  File "/home/tigran/.local/lib/python3.12/site-packages/uvicorn/main.py", line 593, in run
    server.run()
    │      └ <function Server.run at 0x7f5e7eabeca0>
    └ <uvicorn.server.Server object at 0x7f5cd64b3e90>
  File "/home/tigran/.local/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
    return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
           │           │    │             │                      │    │      └ <function Config.get_loop_factory at 0x7f5e7ea5b380>
           │           │    │             │                      │    └ <uvicorn.config.Config object at 0x7f5e7f552840>
           │           │    │             │                      └ <uvicorn.server.Server object at 0x7f5cd64b3e90>
           │           │    │             └ None
           │           │    └ <function Server.serve at 0x7f5e7eabed40>
           │           └ <uvicorn.server.Server object at 0x7f5cd64b3e90>
           └ <function run at 0x7f5e7eb5e480>
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           │      │   └ <coroutine object Server.serve at 0x7f5e7e9cf680>
           │      └ <function Runner.run at 0x7f5e7eb75760>
           └ <asyncio.runners.Runner object at 0x7f5cd65a0b00>
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           │    │     │                  └ <Task pending name='Task-1' coro=<Server.serve() running at /home/tigran/.local/lib/python3.12/site-packages/uvicorn/server.p...
           │    │     └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           │    └ <uvloop.Loop running=True closed=False debug=False>
           └ <asyncio.runners.Runner object at 0x7f5cd65a0b00>
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/main.py", line 1624, in process_chat
    form_data, metadata, events = await process_chat_payload(
    │          │                        └ <function process_chat_payload at 0x7f5d02b18900>
    │          └ {'user_id': 'cdb67ffa-03ad-442d-a4ca-e63eeb133b06', 'chat_id': '04bc37cc-5014-4f2b-a41d-f89971656a7e', 'message_id': '37ed5d0...
    └ {'stream': True, 'model': 'gpt-oss:120b-cloud', 'messages': [{'role': 'system', 'content': 'User Context:\n\n'}, {'role': 'us...
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/utils/middleware.py", line 1269, in process_chat_payload
    form_data = await chat_web_search_handler(
                      └ <function chat_web_search_handler at 0x7f5d02b18540>
> File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/utils/middleware.py", line 587, in chat_web_search_handler
    response = res["choices"][0]["message"]["content"]
               └ <starlette.responses.JSONResponse object at 0x7f5ccff8e3c0>

TypeError: 'JSONResponse' object is not subscriptable
Fetching pages: 100%|#########################################################################################################################################################################################################################################################| 1/1 [00:00<00:00, 22.05it/s]
2025-12-17 09:45:57.457 | INFO     | open_webui.routers.retrieval:save_docs_to_vector_db:1375 - generating embeddings for web-search-84d7a10bcabee0c53086c09473f82067891d8a611849ec663da9
2025-12-17 09:45:57.459 | ERROR    | open_webui.routers.retrieval:save_docs_to_vector_db:1435 - 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):

  File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7f5e7fd9de40>
    └ <WorkerThread(AnyIO worker thread, started 140036593935936)>
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7f5cd60f34c0>
    └ <WorkerThread(AnyIO worker thread, started 140036593935936)>
  File "/home/tigran/.local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 967, in run
    result = context.run(func, *args)
             │       │   │      └ ()
             │       │   └ functools.partial(<function save_docs_to_vector_db at 0x7f5d38898d60>, <starlette.requests.Request object at 0x7f5cccce1250>,...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7f5ccceb4ec0>
> File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 1407, in save_docs_to_vector_db
    embeddings = asyncio.run(
                 │       └ <function run at 0x7f5e7eb5e480>
                 └ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/__init__.py'>
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           │      │   └ <coroutine object get_embedding_function.<locals>.async_embedding_function at 0x7f5cd60724d0>
           │      └ <function Runner.run at 0x7f5e7eb75760>
           └ <asyncio.runners.Runner object at 0x7f5cccce0d70>
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           │    │                        └ <Task finished name='Task-43251' coro=<get_embedding_function.<locals>.async_embedding_function() done, defined at /home/tigr...
           │    └ None
           └ <asyncio.runners.Runner object at 0x7f5cccce0d70>
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           │      └ <method 'result' of '_asyncio.Task' objects>
           └ <Task finished name='Task-43251' coro=<get_embedding_function.<locals>.async_embedding_function() done, defined at /home/tigr...
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 790, in async_embedding_function
    return await asyncio.to_thread(
                 │       └ <function to_thread at 0x7f5e7eb89e40>
                 └ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/__init__.py'>
  File "/usr/local/lib/python3.12/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
                 │    │                     └ functools.partial(<built-in method run of _contextvars.Context object at 0x7f5cccb60640>, <function get_embedding_function.<l...
                 │    └ <function BaseEventLoop.run_in_executor at 0x7f5e7eb6fc40>
                 └ <_UnixSelectorEventLoop running=False closed=True debug=False>
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             │        │            └ None
             │        └ None
             └ None
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 792, in <lambda>
    lambda query, prefix=None: embedding_function.encode(
           │                   └ None
           └ ['Just a moment...Enable JavaScript and cookies to continue']

AttributeError: 'NoneType' object has no attribute 'encode'
2025-12-17 09:45:58.675 | ERROR    | open_webui.retrieval.utils:get_sources_from_items:1169 - 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):

  File "/home/tigran/.local/bin/open-webui", line 8, in <module>
    sys.exit(app())
    │   │    └ <typer.main.Typer object at 0x7f5e7fc00860>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/main.py", line 309, in __call__
    return get_command(self)(*args, **kwargs)
           │           │      │       └ {}
           │           │      └ ()
           │           └ <typer.main.Typer object at 0x7f5e7fc00860>
           └ <function get_command at 0x7f5e7f235760>
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ ()
           │    └ <function TyperGroup.main at 0x7f5e7f233f60>
           └ <TyperGroup >
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/core.py", line 723, in main
    return _main(
           └ <function _main at 0x7f5e7f232fc0>
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/core.py", line 193, in _main
    rv = self.invoke(ctx)
         │    │      └ <click.core.Context object at 0x7f5e7ea728d0>
         │    └ <function Group.invoke at 0x7f5e7f965580>
         └ <TyperGroup >
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
           │               │       │       │      └ <click.core.Context object at 0x7f5e7fc10da0>
           │               │       │       └ <function Command.invoke at 0x7f5e7f964360>
           │               │       └ <TyperCommand serve>
           │               └ <click.core.Context object at 0x7f5e7fc10da0>
           └ <function Group.invoke.<locals>._process_result at 0x7f5e7e82aa20>
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'host': '0.0.0.0', 'port': 8080}
           │   │      │    │           └ <click.core.Context object at 0x7f5e7fc10da0>
           │   │      │    └ <function serve at 0x7f5e7e82a840>
           │   │      └ <TyperCommand serve>
           │   └ <function Context.invoke at 0x7f5e7f95b560>
           └ <click.core.Context object at 0x7f5e7fc10da0>
  File "/home/tigran/.local/lib/python3.12/site-packages/click/core.py", line 794, in invoke
    return callback(*args, **kwargs)
           │         │       └ {'host': '0.0.0.0', 'port': 8080}
           │         └ ()
           └ <function serve at 0x7f5e7e82a840>
  File "/home/tigran/.local/lib/python3.12/site-packages/typer/main.py", line 692, in wrapper
    return callback(**use_params)
           │          └ {'host': '0.0.0.0', 'port': 8080}
           └ <function serve at 0x7f5e7e933240>
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/__init__.py", line 78, in serve
    uvicorn.run(
    │       └ <function run at 0x7f5e7eabf420>
    └ <module 'uvicorn' from '/home/tigran/.local/lib/python3.12/site-packages/uvicorn/__init__.py'>
  File "/home/tigran/.local/lib/python3.12/site-packages/uvicorn/main.py", line 593, in run
    server.run()
    │      └ <function Server.run at 0x7f5e7eabeca0>
    └ <uvicorn.server.Server object at 0x7f5cd64b3e90>
  File "/home/tigran/.local/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
    return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
           │           │    │             │                      │    │      └ <function Config.get_loop_factory at 0x7f5e7ea5b380>
           │           │    │             │                      │    └ <uvicorn.config.Config object at 0x7f5e7f552840>
           │           │    │             │                      └ <uvicorn.server.Server object at 0x7f5cd64b3e90>
           │           │    │             └ None
           │           │    └ <function Server.serve at 0x7f5e7eabed40>
           │           └ <uvicorn.server.Server object at 0x7f5cd64b3e90>
           └ <function run at 0x7f5e7eb5e480>
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           │      │   └ <coroutine object Server.serve at 0x7f5e7e9cf680>
           │      └ <function Runner.run at 0x7f5e7eb75760>
           └ <asyncio.runners.Runner object at 0x7f5cd65a0b00>
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           │    │     │                  └ <Task pending name='Task-1' coro=<Server.serve() running at /home/tigran/.local/lib/python3.12/site-packages/uvicorn/server.p...
           │    │     └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           │    └ <uvloop.Loop running=True closed=False debug=False>
           └ <asyncio.runners.Runner object at 0x7f5cd65a0b00>
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/main.py", line 1624, in process_chat
    form_data, metadata, events = await process_chat_payload(
    │          │                        └ <function process_chat_payload at 0x7f5d02b18900>
    │          └ {'user_id': 'cdb67ffa-03ad-442d-a4ca-e63eeb133b06', 'chat_id': '04bc37cc-5014-4f2b-a41d-f89971656a7e', 'message_id': '37ed5d0...
    └ {'stream': True, 'model': 'gpt-oss:120b-cloud', 'messages': [{'role': 'system', 'content': 'User Context:\n\n'}, {'role': 'us...
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/utils/middleware.py", line 1506, in process_chat_payload
    form_data, flags = await chat_completion_files_handler(
    │                        └ <function chat_completion_files_handler at 0x7f5d02b187c0>
    └ {'stream': True, 'model': 'gpt-oss:120b-cloud', 'messages': [{'role': 'system', 'content': 'User Context:\n\n'}, {'role': 'us...
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/utils/middleware.py", line 989, in chat_completion_files_handler
    sources = await get_sources_from_items(
                    └ <function get_sources_from_items at 0x7f5d3889a020>
> File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 1162, in get_sources_from_items
    query_result = await query_collection(
                         └ <function query_collection at 0x7f5d38899760>
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 427, in query_collection
    query_embeddings = await embedding_function(
                             └ <function chat_completion_files_handler.<locals>.<lambda> at 0x7f5cccdf7920>
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 790, in async_embedding_function
    return await asyncio.to_thread(
                 │       └ <function to_thread at 0x7f5e7eb89e40>
                 └ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/__init__.py'>
  File "/usr/local/lib/python3.12/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
                 │    │                     └ functools.partial(<built-in method run of _contextvars.Context object at 0x7f5cd655dcc0>, <function get_embedding_function.<l...
                 │    └ <method 'run_in_executor' of 'uvloop.loop.Loop' objects>
                 └ <uvloop.Loop running=True closed=False debug=False>
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             │        │            └ None
             │        └ None
             └ None
  File "/home/tigran/.local/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 792, in <lambda>
    lambda query, prefix=None: embedding_function.encode(
           │                   └ None
           └ ['Дай мне список самых свежих новостей, со ссылками на источники. Используй веб поиск.']

AttributeError: 'NoneType' object has no attribute 'encode'


### Additional Information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions