From e623081b2bbfda304f8394da285a2ac37352624a Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 1 Jun 2026 21:07:31 +0200 Subject: [PATCH] fix: handle list-shape data in Firecrawl /search response (#24712) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Firecrawl /search returns either `{"data": [...]}` (flat list — v1, and what frost19k reported on #23966) or `{"data": {"web": [...]}}` (v2, current production). The parser only handled the dict shape: data = response.get('data') or {} results = data.get('web') or [] On a list-shape response, `data.get('web')` raised AttributeError, caught by the function's outer try/except, and `search_firecrawl` silently returned []. Web search worked against v2 endpoints but is one upstream-format-change away from failing closed again. Accept either. --- backend/open_webui/retrieval/web/firecrawl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/retrieval/web/firecrawl.py b/backend/open_webui/retrieval/web/firecrawl.py index 4bbd4f212b..baffb6207d 100644 --- a/backend/open_webui/retrieval/web/firecrawl.py +++ b/backend/open_webui/retrieval/web/firecrawl.py @@ -197,8 +197,11 @@ def search_firecrawl( }, timeout=count * 3 + 10, ) + # Firecrawl /search has historically returned both `{"data": [...]}` + # (flat list, what v1 did and what frost19k reported under #23966) + # and `{"data": {"web": [...]}}` (current v2). Accept either. data = response.get('data') or {} - results = data.get('web') or [] + results = data if isinstance(data, list) else (data.get('web') or []) if filter_list: from open_webui.retrieval.web.main import get_filtered_results