[PR #22308] [CLOSED] fix: Handle search_web error in citation parser #42235

Closed
opened 2026-04-25 14:13:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22308
Author: @fskeung
Created: 3/6/2026
Status: Closed

Base: mainHead: fix/search-web-citation-error


📝 Commits (2)

  • 426b314 fix: Clear selected tools when switching models
  • 44461a2 fix: Handle search_web error case in citation parser

📊 Changes

2 files changed (+7 additions, -3 deletions)

View changed files

📝 backend/open_webui/utils/middleware.py (+5 -0)
📝 src/lib/components/chat/Chat.svelte (+2 -3)

📄 Description

Summary

When web search fails and returns an error string instead of a valid JSON list, the citation parser crashes with AttributeError: 'str' object has no attribute 'get'.

Changes

  • Added type check in get_citation_source_from_tool_result function
  • Returns empty list when search_web result is not a valid list

Issue

Fixes #21070 - AttributeError: 'str' object has no attribute 'get' in citation parser when web search fails


🔄 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/22308 **Author:** [@fskeung](https://github.com/fskeung) **Created:** 3/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/search-web-citation-error` --- ### 📝 Commits (2) - [`426b314`](https://github.com/open-webui/open-webui/commit/426b314330cd0e35b87308376cf0258176c57045) fix: Clear selected tools when switching models - [`44461a2`](https://github.com/open-webui/open-webui/commit/44461a227d620efc92a62dc3dda1765d12aeb19c) fix: Handle search_web error case in citation parser ### 📊 Changes **2 files changed** (+7 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+5 -0) 📝 `src/lib/components/chat/Chat.svelte` (+2 -3) </details> ### 📄 Description ## Summary When web search fails and returns an error string instead of a valid JSON list, the citation parser crashes with `AttributeError: 'str' object has no attribute 'get'`. ## Changes - Added type check in `get_citation_source_from_tool_result` function - Returns empty list when search_web result is not a valid list ## Issue Fixes #21070 - AttributeError: 'str' object has no attribute 'get' in citation parser when web search fails --- <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-25 14:13:08 -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#42235