Adds a None guard to xml_element_contents_to_string() in backend/open_webui/retrieval/web/yandex.py
Element.find() returns None when the XPath does not match (e.g., a search result lacks a doc/passages/passage element), and passing None to this function causes AttributeError: 'NoneType' object has no attribute 'text'
This crashes the entire Yandex web search for any query where at least one result is missing a passage, title, or URL element
Test plan
Perform a Yandex web search with a query that returns results with and without passage snippets
Verify the search completes without errors and results without passages show empty snippets
Verify normal Yandex search results still display correctly
🔄 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/22416
**Author:** [@gambletan](https://github.com/gambletan)
**Created:** 3/8/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix/yandex-search-nonetype-crash`
---
### 📝 Commits (1)
- [`956ba6c`](https://github.com/open-webui/open-webui/commit/956ba6c8e6a5586e43441310643bb0a1fdb64607) fix: handle missing XML elements in Yandex search results
### 📊 Changes
**1 file changed** (+4 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/retrieval/web/yandex.py` (+4 -1)
</details>
### 📄 Description
## Summary
- Adds a `None` guard to `xml_element_contents_to_string()` in `backend/open_webui/retrieval/web/yandex.py`
- `Element.find()` returns `None` when the XPath does not match (e.g., a search result lacks a `doc/passages/passage` element), and passing `None` to this function causes `AttributeError: 'NoneType' object has no attribute 'text'`
- This crashes the entire Yandex web search for any query where at least one result is missing a passage, title, or URL element
## Test plan
- [ ] Perform a Yandex web search with a query that returns results with and without passage snippets
- [ ] Verify the search completes without errors and results without passages show empty snippets
- [ ] Verify normal Yandex search results still display correctly
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22416
Author: @gambletan
Created: 3/8/2026
Status: ❌ Closed
Base:
main← Head:fix/yandex-search-nonetype-crash📝 Commits (1)
956ba6cfix: handle missing XML elements in Yandex search results📊 Changes
1 file changed (+4 additions, -1 deletions)
View changed files
📝
backend/open_webui/retrieval/web/yandex.py(+4 -1)📄 Description
Summary
Noneguard toxml_element_contents_to_string()inbackend/open_webui/retrieval/web/yandex.pyElement.find()returnsNonewhen the XPath does not match (e.g., a search result lacks adoc/passages/passageelement), and passingNoneto this function causesAttributeError: 'NoneType' object has no attribute 'text'Test plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.