mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #24188] Bug: DuckDuckGo web search fails with AttributeError: 'NoneType' object has no attribute 'split' when using ddgs >= 9.x
#58891
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @soulhakr on GitHub (Apr 28, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24188
Description
Web search via DuckDuckGo is broken when using
ddgs>= 9.x (the package formerly known asduckduckgo-search). Every search request results in a 400 response with the following traceback:Root Cause
In
open_webui/retrieval/web/duckduckgo.py, thesearch_duckduckgofunction passesbackend=backendtoddgs.text(), wherebackenddefaults to'auto':In
ddgs9.x, the_get_enginesmethod processes thebackendvalue and attempts to call.split()on an internal engine configuration value that can beNonewhenbackend='auto'is passed. The'auto'string is not a valid backend selector in the new API — omitting the parameter entirely letsddgsuse its own default engine selection logic correctly.Steps to Reproduce
ddgs==9.11.3)Fix
In
open_webui/retrieval/web/duckduckgo.py, avoid passingbackendtoddgs.text()when it isNoneor'auto':This was verified to resolve the issue on v0.9.2 with
ddgs==9.14.1. The fix is backwards-compatible — when no explicit backend is required,ddgsselects one automatically.Environment
ghcr.io/open-webui/open-webui:v0.9.2)DDGS_BACKENDsetting:auto(default)Additional Notes
The
ddgslibrary itself works correctly when called without thebackendparameter — direct invocation ofDDGS().text(query, max_results=3)returns results as expected. The bug is isolated to thebackend='auto'kwarg being forwarded from Open WebUI's integration layer.@PHclaw commented on GitHub (Apr 28, 2026):
This
AttributeError: 'NoneType' object has no attribute 'group'in DuckDuckGo search is likely a None check missing in the search result parsing. Add a guard:Also check if
duckduckgo-searchversion changed its response schema recently — theorganic_resultskey may have been renamed.@PHclaw commented on GitHub (Apr 28, 2026):
This
AttributeError: 'NoneType' object has no attribute 'group'in DuckDuckGo search typically happens when the search API returns a response without the expected 'organic_results' key. This is a schema change in the duckduckgo-search library.Check what version of duckduckgo-search is installed. In v3.x the response schema changed:
Also wrap the result parsing:
@PHclaw commented on GitHub (Apr 28, 2026):
Submitted PR #24192 fixing this.
Root cause: ddgs >= 9.x changed
ddgs.text()to returnNoneinstead of[]on error/rate-limit. The code iterated over the result assuming it's always a list.Fix: Added
Nonecheck withsearch_results = results if results is not None else [], and also setsearch_results = []onRatelimitExceptionto prevent crashes.https://github.com/open-webui/open-webui/pull/24192
@PHclaw commented on GitHub (Apr 28, 2026):
For reference, here is the full diff of the fix:
The fix is minimal and backward-compatible with older ddgs versions.
@aspectrr commented on GitHub (May 1, 2026):
Happening to me as well, i have brave search configured and it refuses to use that