From c2a40b2dc9ce5998dc058b0c8dd09bc7e7a5458f Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Fri, 10 Jul 2026 19:01:30 +0530 Subject: [PATCH] fix(web): handle short extract provider results --- tools/web_tools.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/web_tools.py b/tools/web_tools.py index 64dc5e1c726..7754c386a56 100644 --- a/tools/web_tools.py +++ b/tools/web_tools.py @@ -947,7 +947,19 @@ async def web_extract_tool( # provider-processed entries. Providers are expected to preserve the # order of the safe URL list they receive. if invalid_urls or ssrf_blocked: - safe_results = dict(zip(safe_indices, results)) + safe_results = { + index: ( + results[position] + if position < len(results) + else { + "url": safe_urls[position], + "title": "", + "content": "", + "error": "Extract backend returned no result for this URL", + } + ) + for position, index in enumerate(safe_indices) + } by_index = {**safe_results, **ssrf_blocked, **invalid_urls} results = [by_index[index] for index in range(len(urls))]