mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #24243] bug: Yandex web search fails with NoneType error when XML response has missing fields #58907
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 @nikitavich on GitHub (Apr 29, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24243
Summary
Web search via the Yandex provider (added in v0.9.x) fails with
'NoneType' object has no attribute 'text'whenever the Yandex Search API XML response contains a result document missing one of the fields the parser expects (<url>,<title>,<passages>/<passage>).The error is silently swallowed inside
search_yandex(onlylog.erroris called) and the function returns an empty list, so the user-facing result is "No results found from web search" even though the Yandex API call itself succeeded with HTTP 200 and returned valid results.Affected version
v0.9.0 – v0.9.2 (current main as of 2026-04-29 still has the bug).
Reproduction
<group>/<doc>has no<passages>/<passage>child or has an empty<title>In our environment the failure was reliably triggered by Russian-language queries with broad intent. A direct call to
https://searchapi.api.cloud.yandex.net/v2/web/searchreturned valid base64-encoded XML with 3 groups, but one group lacked<doc/passages/passage>, causinggroup.find('doc/passages/passage')to returnNone.Stack trace
Root cause
In
backend/open_webui/retrieval/web/yandex.py, thexml_element_contents_to_stringhelper accesseselement.textunconditionally, but it is called with the result ofgroup.find('doc/url')/doc/title/doc/passages/passage, any of which may returnNonewhen the corresponding XML node is absent in a particular result.Suggested fix
Trivial one-liner — guard against
Noneat the top of the helper:Verified on our deployment: after applying this patch, the same query that previously returned no results now returns 5 valid results (championat.com, sports.ru, f1news.ru, avito.ru) without errors.
Happy to send a PR if it would help.
Environment
ghcr.io/open-webui/open-webui:v0.9.2)searchapi.api.cloud.yandex.net/v2/web/search)YANDEX_WEB_SEARCH_CONFIG),searchType: SEARCH_TYPE_RU@pr-validator-bot commented on GitHub (Apr 29, 2026):
⚠️ Missing Issue Title Prefix
@nikitavich, your issue title is missing a prefix (e.g.,
bug:,feat:,docs:).Please update your issue title to include one of the following prefixes:
Example:
bug: Login fails when using special characters in password