[PR #24192] fix: handle ddgs.text() returning None (ddgs >= 9.x API change) #50542

Open
opened 2026-04-30 03:19:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24192
Author: @PHclaw
Created: 4/28/2026
Status: 🔄 Open

Base: mainHead: fix/ddgs-none-check


📝 Commits (1)

  • f7ce612 fix: handle ddgs.text() returning None (ddgs >= 9.x API change)

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 backend/open_webui/retrieval/web/duckduckgo.py (+4 -1)

📄 Description

Summary

ddgs >= 9.x changed the API: ddgs.text() now returns None instead of an empty list when the backend is unavailable, rate-limited, or encounters other errors. The existing code assumed it always returns a list, causing:

TypeError: 'NoneType' object is not iterable

Changes

backend/open_webui/retrieval/web/duckduckgo.py:

# Before (buggy)
try:
    search_results = ddgs.text(query, ...)
except RatelimitException as e:
    log.error(f"RatelimitException: {e}")
if filter_list:
    search_results = get_filtered_results(search_results, filter_list)  # crashes if None

# After (fixed)
try:
    results = ddgs.text(query, ...)
    search_results = results if results is not None else []
except RatelimitException as e:
    log.error(f"RatelimitException: {e}")
    search_results = []
if filter_list:
    search_results = get_filtered_results(search_results, filter_list)

Closes #24188


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24192 **Author:** [@PHclaw](https://github.com/PHclaw) **Created:** 4/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/ddgs-none-check` --- ### 📝 Commits (1) - [`f7ce612`](https://github.com/open-webui/open-webui/commit/f7ce612d03d39a55d430e79f9183cd5d4ab854c9) fix: handle ddgs.text() returning None (ddgs >= 9.x API change) ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/retrieval/web/duckduckgo.py` (+4 -1) </details> ### 📄 Description ## Summary ddgs >= 9.x changed the API: `ddgs.text()` now returns `None` instead of an empty list when the backend is unavailable, rate-limited, or encounters other errors. The existing code assumed it always returns a list, causing: ``` TypeError: 'NoneType' object is not iterable ``` ## Changes `backend/open_webui/retrieval/web/duckduckgo.py`: ```python # Before (buggy) try: search_results = ddgs.text(query, ...) except RatelimitException as e: log.error(f"RatelimitException: {e}") if filter_list: search_results = get_filtered_results(search_results, filter_list) # crashes if None # After (fixed) try: results = ddgs.text(query, ...) search_results = results if results is not None else [] except RatelimitException as e: log.error(f"RatelimitException: {e}") search_results = [] if filter_list: search_results = get_filtered_results(search_results, filter_list) ``` Closes #24188 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 03:19:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#50542