[GH-ISSUE #19733] issue: AttributeError: 'str' object has no attribute 'get' when using Bocha search engine #57639

Closed
opened 2026-05-05 21:16:48 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @Sorkai on GitHub (Dec 4, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19733

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

v0.6.41

Ollama Version (if applicable)

No response

Operating System

Windows 11 Version 25H2 (Build 26200.7309)

Browser (if applicable)

Microsoft Edge 142.0.3595.94

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 (Bocha): When using bocha as the search engine, it should correctly parse the JSON response and return search results without crashing.

Actual Behavior

When using bocha as the Web Search Engine, the retrieval process crashes with an AttributeError. The logs indicate that the application is receiving a dictionary response from the Bocha API (containing a "webpage" key) but is iterating over the dictionary keys (specifically the string "webpage") instead of the list of results inside it. This causes get_filtered_results to fail when it tries to call .get() on a string.

Steps to Reproduce

  1. Go to Settings -> Web Search.
  2. Set Search Engine to bocha and provide a valid API key
  3. In a chat, ask a question that triggers a web search (e.g., "Weather in Changchun")
  4. Observe the error in the UI ("An error occurred while searching the web").

Logs & Screenshots

File "/app/backend/open_webui/routers/retrieval.py", line 1881, in search_web
    return search_bocha( ... )
File "/app/backend/open_webui/retrieval/web/bocha.py", line 58, in search_bocha
    results = get_filtered_results(results, filter_list)
File "/app/backend/open_webui/retrieval/web/main.py", line 19, in get_filtered_results
    url = result.get("url") or result.get("link", "") or result.get("href", "")
AttributeError: 'str' object has no attribute 'get'

1Panel-ollama-webui-9dLT-20251204124325.log

Additional Information

Based on the logs, the data passed to get_filtered_results is: {'webpage': [{'id': '...', 'name': '...', ...}]} The code seems to need to extract results['webpage'] before passing it to get_filtered_results in bocha.py.

Originally created by @Sorkai on GitHub (Dec 4, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/19733 ### 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 v0.6.41 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 Version 25H2 (Build 26200.7309) ### Browser (if applicable) Microsoft Edge 142.0.3595.94 ### 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 Web Search (Bocha): When using bocha as the search engine, it should correctly parse the JSON response and return search results without crashing. ### Actual Behavior When using bocha as the Web Search Engine, the retrieval process crashes with an AttributeError. The logs indicate that the application is receiving a dictionary response from the Bocha API (containing a "webpage" key) but is iterating over the dictionary keys (specifically the string "webpage") instead of the list of results inside it. This causes get_filtered_results to fail when it tries to call .get() on a string. ### Steps to Reproduce 1. Go to Settings -> Web Search. 2. Set Search Engine to bocha and provide a valid API key 3. In a chat, ask a question that triggers a web search (e.g., "Weather in Changchun") 4. Observe the error in the UI ("An error occurred while searching the web"). ### Logs & Screenshots ``` File "/app/backend/open_webui/routers/retrieval.py", line 1881, in search_web return search_bocha( ... ) File "/app/backend/open_webui/retrieval/web/bocha.py", line 58, in search_bocha results = get_filtered_results(results, filter_list) File "/app/backend/open_webui/retrieval/web/main.py", line 19, in get_filtered_results url = result.get("url") or result.get("link", "") or result.get("href", "") AttributeError: 'str' object has no attribute 'get' ``` [1Panel-ollama-webui-9dLT-20251204124325.log](https://github.com/user-attachments/files/23923038/1Panel-ollama-webui-9dLT-20251204124325.log) ### Additional Information Based on the logs, the data passed to get_filtered_results is: {'webpage': [{'id': '...', 'name': '...', ...}]} The code seems to need to extract results['webpage'] before passing it to get_filtered_results in bocha.py.
GiteaMirror added the bug label 2026-05-05 21:16:48 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 4, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19698 issue: .41 web based search and webpages - RAG - are not fixed
    by frenzybiscuit • Dec 02, 2025 • bug

  2. #11661 issue: Can not use Bocha websearch API, return "No search results found"
    by pandalaohe • Mar 14, 2025 • bug

  3. #19654 issue: Type Error when adding URL to chat context
    by apunkt • Dec 01, 2025 • bug

  4. #19563 issue:
    by naruto7g • Nov 28, 2025 • bug

  5. #19211 issue:
    by Byrnes9 • Nov 16, 2025 • bug

Show 5 more related issues
  1. #13536 issue: Searching doesn't work, at all.
    by SerenoV7 • May 05, 2025 • bug

  2. #16847 issue: The online search function using searxng is not working (v0.6.25)
    by GN998 • Aug 23, 2025 • bug

  3. #19247 issue: Sporadic server errors when searching chats
    by richardwatts-seale • Nov 17, 2025 • bug

  4. #11721 issue: Web Search not working!
    by Hashah2311 • Mar 15, 2025 • bug

  5. #19417 issue: v0.6.37 SQL Error
    by AKHYP • Nov 24, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3610149917 --> @owui-terminator[bot] commented on GitHub (Dec 4, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19698](https://github.com/open-webui/open-webui/issues/19698) **issue: .41 web based search and webpages - RAG - are not fixed** *by frenzybiscuit • Dec 02, 2025 • `bug`* 2. [#11661](https://github.com/open-webui/open-webui/issues/11661) **issue: Can not use Bocha websearch API, return "No search results found"** *by pandalaohe • Mar 14, 2025 • `bug`* 3. [#19654](https://github.com/open-webui/open-webui/issues/19654) **issue: Type Error when adding URL to chat context** *by apunkt • Dec 01, 2025 • `bug`* 4. [#19563](https://github.com/open-webui/open-webui/issues/19563) **issue:** *by naruto7g • Nov 28, 2025 • `bug`* 5. [#19211](https://github.com/open-webui/open-webui/issues/19211) **issue:** *by Byrnes9 • Nov 16, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#13536](https://github.com/open-webui/open-webui/issues/13536) **issue: Searching doesn't work, at all.** *by SerenoV7 • May 05, 2025 • `bug`* 7. [#16847](https://github.com/open-webui/open-webui/issues/16847) **issue: The online search function using searxng is not working (v0.6.25)** *by GN998 • Aug 23, 2025 • `bug`* 8. [#19247](https://github.com/open-webui/open-webui/issues/19247) **issue: Sporadic server errors when searching chats** *by richardwatts-seale • Nov 17, 2025 • `bug`* 9. [#11721](https://github.com/open-webui/open-webui/issues/11721) **issue: Web Search not working!** *by Hashah2311 • Mar 15, 2025 • `bug`* 10. [#19417](https://github.com/open-webui/open-webui/issues/19417) **issue: v0.6.37 SQL Error** *by AKHYP • Nov 24, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@Classic298 commented on GitHub (Dec 14, 2025):

@silentoplayz maybe you can repro?

<!-- gh-comment-id:3652223197 --> @Classic298 commented on GitHub (Dec 14, 2025): @silentoplayz maybe you can repro?
Author
Owner

@silentoplayz commented on GitHub (Dec 15, 2025):

@silentoplayz maybe you can repro?

I can't test this one.

<!-- gh-comment-id:3652805359 --> @silentoplayz commented on GitHub (Dec 15, 2025): > [@silentoplayz](https://github.com/silentoplayz) maybe you can repro? I can't test this one.
Author
Owner

@Sorkai commented on GitHub (Dec 15, 2025):

@silentoplayz maybe you can repro?

I can't test this one.

What kind of tests are needed? I think I can handle them.

<!-- gh-comment-id:3655569977 --> @Sorkai commented on GitHub (Dec 15, 2025): > > [@silentoplayz](https://github.com/silentoplayz) maybe you can repro? > > I can't test this one. What kind of tests are needed? I think I can handle them.
Author
Owner

@Classic298 commented on GitHub (Dec 15, 2025):

@Sorkai you reported the issue

Someone else should independently test, if your report is reproducible. If it is it can be fixed

<!-- gh-comment-id:3655701916 --> @Classic298 commented on GitHub (Dec 15, 2025): @Sorkai you reported the issue Someone else should independently test, if your report is reproducible. If it is it can be fixed
Author
Owner

@zengxy commented on GitHub (Dec 17, 2025):

I also encountered this bug, which can be reproduced when the domain filter list is set to non-empty. I submitted a PR to fix it.
@Classic298

<!-- gh-comment-id:3663974384 --> @zengxy commented on GitHub (Dec 17, 2025): I also encountered this bug, which can be reproduced when the domain filter list is set to non-empty. I submitted a PR to fix it. @Classic298
Author
Owner

@Classic298 commented on GitHub (Dec 20, 2025):

fixed in dev, thanks!

b5bd8704fe

<!-- gh-comment-id:3677826165 --> @Classic298 commented on GitHub (Dec 20, 2025): fixed in dev, thanks! https://github.com/open-webui/open-webui/commit/b5bd8704fe1672da839bb3be6210d7cb494797ce
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#57639