mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #21244] [CLOSED] Fix AttributeError in citation parser when web search fails #41618
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21244
Author: @veeceey
Created: 2/8/2026
Status: ❌ Closed
Base:
main← Head:fix/issue-21070-citation-parser-error📝 Commits (1)
21e309fFix AttributeError in citation parser when web search fails📊 Changes
1 file changed (+8 additions, -3 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+8 -3)📄 Description
Summary
Problem
When
search_webor other builtin tools encounter errors (timeout, API failure, etc.), they return{"error": "..."}instead of the expected list format. The citation parser inmiddleware.pywas iterating over this dict, which yields string keys like"error". When the code tried to call.get()on these strings, it crashed with:Solution
Added early error detection at the start of
get_citation_source_from_tool_result():Manual Testing
Test Setup
Before Fix
After Fix
Additional Tests
query_knowledge_fileserror handling: works correctlyview_knowledge_fileerror handling: works correctlyRoot Cause
In
backend/open_webui/tools/builtin.py:178-180:In
backend/open_webui/utils/middleware.py:163-170:Fixes #21070
Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.