[GH-ISSUE #21645] issue: websearch with Native mode and API Responses not working #19544

Closed
opened 2026-04-20 02:00:57 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @MarceloMassarente on GitHub (Feb 20, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21645

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

Docker

Open WebUI Version

0.8.3

Ollama Version (if applicable)

No response

Operating System

Ubuntu

Browser (if applicable)

No response

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

with API Response set, and Native mode, GPT-5 should behave like in Standard, launch websearch and get the answer back to the chat

Actual Behavior

The websearch launches, immediatelly the chat bar becomes ready again, and after sometime there is an error in the logs
KeyError: 'choices'
...
response = res["choices"][0]["message"]["content"]
...
res = {'id': 'resp_...', 'object': 'response', ...}

Steps to Reproduce

run any websearch with API Response, Native mode and websearch available

Logs & Screenshots

i/v1/chats/?page=1 HTTP/1.1" 200

2026-02-20 08:09:07.886 | ERROR | open_webui.utils.middleware:chat_web_search_handler:1316 - 'choices'

Traceback (most recent call last):

File "/usr/local/bin/open-webui", line 8, in

sys.exit(app())

│   │    └ <typer.main.Typer object at 0x7c13d8cd72d0>

│   └ <built-in function exit>

└ <module 'sys' (built-in)>

File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 1135, in call

return get_command(self)(*args, **kwargs)

       │           │      │       └ {}

       │           │      └ ()

       │           └ <typer.main.Typer object at 0x7c13d8cd72d0>

       └ <function get_command at 0x7c13d87ac400>

File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1485, in call

return self.main(*args, **kwargs)

       │    │     │       └ {}

       │    │     └ ()

       │    └ <function TyperGroup.main at 0x7c13d875be20>

       └ <TyperGroup >

File "/usr/local/lib/python3.11/site-packages/typer/core.py", line 813, in main

return _main(

       └ <function _main at 0x7c13d875aac0>

File "/usr/local/lib/python3.11/site-packages/typer/core.py", line 189, in _main

rv = self.invoke(ctx)

     │    │      └ <click.core.Context object at 0x7c13d7c36f50>

     │    └ <function Group.invoke at 0x7c13d88ab560>

     └ <TyperGroup >

File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1873, in invoke

return _process_result(sub_ctx.command.invoke(sub_ctx))

       │               │       │       │      └ <click.core.Context object at 0x7c13d8722310>

       │               │       │       └ <function Command.invoke at 0x7c13d88aa340>

       │               │       └ <TyperCommand serve>

       │               └ <click.core.Context object at 0x7c13d8722310>

       └ <function Group.invoke.<locals>._process_result at 0x7c13d7c25bc0>

File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1269, in invoke

return ctx.invoke(self.callback, **ctx.params)

       │   │      │    │           │   └ {'host': '0.0.0.0', 'port': 8080}

       │   │      │    │           └ <click.core.Context object at 0x7c13d8722310>

       │   │      │    └ <function serve at 0x7c13d7c258a0>

       │   │      └ <TyperCommand serve>

       │   └ <function Context.invoke at 0x7c13d88a9580>

       └ <click.core.Context object at 0x7c13d8722310>

File "/usr/local/lib/python3.11/site-packages/click/core.py", line 824, in invoke

return callback(*args, **kwargs)

       │         │       └ {'host': '0.0.0.0', 'port': 8080}

       │         └ ()

       └ <function serve at 0x7c13d7c258a0>

File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 1514, in wrapper

return callback(**use_params)

       │          └ {'host': '0.0.0.0', 'port': 8080}

       └ <function serve at 0x7c13d7e3d120>

File "/usr/local/lib/python3.11/site-packages/open_webui/init.py", line 78, in serve

uvicorn.run(

│       └ <function run at 0x7c13d7e99a80>

└ <module 'uvicorn' from '/usr/local/lib/python3.11/site-packages/uvicorn/__init__.py'>

File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 594, in run

server.run()

│      └ <function Server.run at 0x7c13d7e99300>

└ <uvicorn.server.Server object at 0x7c13300bac90>

File "/usr/local/lib/python3.11/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 0x7c13d7e3d620>

       │           │    │             │                      │    └ <uvicorn.config.Config object at 0x7c1329b20bd0>

       │           │    │             │                      └ <uvicorn.server.Server object at 0x7c13300bac90>

       │           │    │             └ None

       │           │    └ <function Server.serve at 0x7c13d7e993a0>

       │           └ <uvicorn.server.Server object at 0x7c13300bac90>

       └ <function asyncio_run at 0x7c13d7df34c0>

File "/usr/local/lib/python3.11/site-packages/uvicorn/_compat.py", line 30, in asyncio_run

return runner.run(main)

       │      │   └ <coroutine object Server.serve at 0x7c1330169210>

       │      └ <function Runner.run at 0x7c13d7f17600>

       └ <asyncio.runners.Runner object at 0x7c1329e60b90>

File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run

return self._loop.run_until_complete(task)

       │    │     │                  └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:71> wai...

       │    │     └ <cyfunction Loop.run_until_complete at 0x7c13312a7a00>

       │    └ <uvloop.Loop running=True closed=False debug=False>

       └ <asyncio.runners.Runner object at 0x7c1329e60b90>

File "/usr/local/lib/python3.11/site-packages/open_webui/main.py", line 1787, in process_chat

form_data, metadata, events = await process_chat_payload(

│          │                        └ <function process_chat_payload at 0x7c133140de40>

│          └ {'user_id': '2bccbed7-2404-4571-a6c3-c0c92cbd776b', 'chat_id': '15d05d58-8d3c-4350-a6d2-dfb32bd8b489', 'message_id': 'd6d7aaf...

└ {'stream': True, 'model': 'gpt-5-mini', 'messages': [{'role': 'system', 'content': 'A data de hoje é 2026-02-20'}, {'role': '...

File "/usr/local/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 2172, in process_chat_payload

form_data = await chat_web_search_handler(

                  └ <function chat_web_search_handler at 0x7c133140d800>

File "/usr/local/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 1297, in chat_web_search_handler

response = res["choices"][0]["message"]["content"]

           └ {'id': 'resp_0bcfe71f69d1f91200699840cb13f0819ea0be24d8061aa987', 'object': 'response', 'created_at': 1771585739, 'status': '...

KeyError: 'choices'

Additional Information

No response

Originally created by @MarceloMassarente on GitHub (Feb 20, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21645 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] 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!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.8.3 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] 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). - [x] 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 with API Response set, and Native mode, GPT-5 should behave like in Standard, launch websearch and get the answer back to the chat ### Actual Behavior The websearch launches, immediatelly the chat bar becomes ready again, and after sometime there is an error in the logs KeyError: 'choices' ... response = res["choices"][0]["message"]["content"] ... res = {'id': 'resp_...', 'object': 'response', ...} ### Steps to Reproduce run any websearch with API Response, Native mode and websearch available ### Logs & Screenshots i/v1/chats/?page=1 HTTP/1.1" 200 2026-02-20 08:09:07.886 | ERROR | open_webui.utils.middleware:chat_web_search_handler:1316 - 'choices' Traceback (most recent call last): File "/usr/local/bin/open-webui", line 8, in <module> sys.exit(app()) │ │ └ <typer.main.Typer object at 0x7c13d8cd72d0> │ └ <built-in function exit> └ <module 'sys' (built-in)> File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 1135, in __call__ return get_command(self)(*args, **kwargs) │ │ │ └ {} │ │ └ () │ └ <typer.main.Typer object at 0x7c13d8cd72d0> └ <function get_command at 0x7c13d87ac400> File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1485, in __call__ return self.main(*args, **kwargs) │ │ │ └ {} │ │ └ () │ └ <function TyperGroup.main at 0x7c13d875be20> └ <TyperGroup > File "/usr/local/lib/python3.11/site-packages/typer/core.py", line 813, in main return _main( └ <function _main at 0x7c13d875aac0> File "/usr/local/lib/python3.11/site-packages/typer/core.py", line 189, in _main rv = self.invoke(ctx) │ │ └ <click.core.Context object at 0x7c13d7c36f50> │ └ <function Group.invoke at 0x7c13d88ab560> └ <TyperGroup > File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1873, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) │ │ │ │ └ <click.core.Context object at 0x7c13d8722310> │ │ │ └ <function Command.invoke at 0x7c13d88aa340> │ │ └ <TyperCommand serve> │ └ <click.core.Context object at 0x7c13d8722310> └ <function Group.invoke.<locals>._process_result at 0x7c13d7c25bc0> File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1269, in invoke return ctx.invoke(self.callback, **ctx.params) │ │ │ │ │ └ {'host': '0.0.0.0', 'port': 8080} │ │ │ │ └ <click.core.Context object at 0x7c13d8722310> │ │ │ └ <function serve at 0x7c13d7c258a0> │ │ └ <TyperCommand serve> │ └ <function Context.invoke at 0x7c13d88a9580> └ <click.core.Context object at 0x7c13d8722310> File "/usr/local/lib/python3.11/site-packages/click/core.py", line 824, in invoke return callback(*args, **kwargs) │ │ └ {'host': '0.0.0.0', 'port': 8080} │ └ () └ <function serve at 0x7c13d7c258a0> File "/usr/local/lib/python3.11/site-packages/typer/main.py", line 1514, in wrapper return callback(**use_params) │ └ {'host': '0.0.0.0', 'port': 8080} └ <function serve at 0x7c13d7e3d120> File "/usr/local/lib/python3.11/site-packages/open_webui/__init__.py", line 78, in serve uvicorn.run( │ └ <function run at 0x7c13d7e99a80> └ <module 'uvicorn' from '/usr/local/lib/python3.11/site-packages/uvicorn/__init__.py'> File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 594, in run server.run() │ └ <function Server.run at 0x7c13d7e99300> └ <uvicorn.server.Server object at 0x7c13300bac90> File "/usr/local/lib/python3.11/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 0x7c13d7e3d620> │ │ │ │ │ └ <uvicorn.config.Config object at 0x7c1329b20bd0> │ │ │ │ └ <uvicorn.server.Server object at 0x7c13300bac90> │ │ │ └ None │ │ └ <function Server.serve at 0x7c13d7e993a0> │ └ <uvicorn.server.Server object at 0x7c13300bac90> └ <function asyncio_run at 0x7c13d7df34c0> File "/usr/local/lib/python3.11/site-packages/uvicorn/_compat.py", line 30, in asyncio_run return runner.run(main) │ │ └ <coroutine object Server.serve at 0x7c1330169210> │ └ <function Runner.run at 0x7c13d7f17600> └ <asyncio.runners.Runner object at 0x7c1329e60b90> File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) │ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:71> wai... │ │ └ <cyfunction Loop.run_until_complete at 0x7c13312a7a00> │ └ <uvloop.Loop running=True closed=False debug=False> └ <asyncio.runners.Runner object at 0x7c1329e60b90> File "/usr/local/lib/python3.11/site-packages/open_webui/main.py", line 1787, in process_chat form_data, metadata, events = await process_chat_payload( │ │ └ <function process_chat_payload at 0x7c133140de40> │ └ {'user_id': '2bccbed7-2404-4571-a6c3-c0c92cbd776b', 'chat_id': '15d05d58-8d3c-4350-a6d2-dfb32bd8b489', 'message_id': 'd6d7aaf... └ {'stream': True, 'model': 'gpt-5-mini', 'messages': [{'role': 'system', 'content': 'A data de hoje é 2026-02-20'}, {'role': '... File "/usr/local/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 2172, in process_chat_payload form_data = await chat_web_search_handler( └ <function chat_web_search_handler at 0x7c133140d800> > File "/usr/local/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 1297, in chat_web_search_handler response = res["choices"][0]["message"]["content"] └ {'id': 'resp_0bcfe71f69d1f91200699840cb13f0819ea0be24d8061aa987', 'object': 'response', 'created_at': 1771585739, 'status': '... KeyError: 'choices' ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-20 02:00:57 -05:00
Author
Owner

@tjbck commented on GitHub (Feb 22, 2026):

Status: Open.
#21340

<!-- gh-comment-id:3941877515 --> @tjbck commented on GitHub (Feb 22, 2026): Status: Open. #21340
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#19544