Skip to content

Conversation

@minturtle
Copy link

@minturtle minturtle commented Nov 21, 2025

Features

  • Fixed a bug where Manus Agent using the browser_use tool’s web_search action crashes with list index out of range when all configured search engines (Google / DuckDuckGo / Baidu / Bing) return empty results (results: []).
  • Added a guard before accessing first_search_result in web_search_tool to validate the result list length and, when empty, return a meaningful error message instead of raising an index error.
  • Improved the error propagation so that Manus Agent can treat this situation as “search failed / no results”, instead of misinterpreting it as an internal tool failure and repeatedly issuing the same query.

Feature Docs

  • No documentation changes are required. This PR only improves runtime error handling and error messages for edge cases in web search.

Influence

  • For normal scenarios where at least one search engine returns results, behavior remains unchanged.

  • In edge cases where all search engines return empty results (e.g., due to being blocked by a captcha while still returning HTTP 200 and HTML content):

    • The list index out of range exception no longer occurs.
    • The tool now returns an explicit “no search results from any engine” error message, which is surfaced as a tool_message.
    • This reduces the chance that Manus Agent will interpret the situation as an internal failure and aggressively retry the same query.

Result

  • i used gpt-oss-120b.

  • Reproduced an environment where all engines return results: [] (captcha on Bing in my case) and verified:

    • Before the fix:

      • Error: Browser action 'web_search' failed: list index out of range is raised.
      • The error string is injected into tool_message, and Manus Agent then appears to re-issue the same query multiple times.
2025-11-21 14:02:06.065 | INFO     | app.agent.toolcall:think:89 - 🔧 Tool arguments: {"action": "web_search", "query": "2025 AI agent news site:arxiv.org"}
2025-11-21 14:02:06.066 | INFO     | app.agent.toolcall:execute_tool:180 - 🔧 Activating tool: 'browser_use'...
2025-11-21 14:02:06.067 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Google...
2025-11-21 14:02:06.672 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Duckduckgo...
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+news+site%3Aarxiv.org 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+news+site%3Aarxiv.org&first=11&FORM=PERE 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+news+site%3Aarxiv.org&first=21&FORM=PERE1 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+news+site%3Aarxiv.org&first=31&FORM=PERE2 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+news+site%3Aarxiv.org&first=41&FORM=PERE3 200
2025-11-21 14:02:10.246 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Baidu...
2025-11-21 14:02:11.626 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Bing...
2025-11-21 14:02:12.137 | WARNING  | app.tool.web_search:execute:274 - All search engines failed. Waiting 10 seconds before retry 1/3...
  • After 3 retries, the following log appears:
Error: Browser action 'web_search' failed: list index out of range
  • The ToolMessage content then contains:
Observed output of cmd `browser_use` executed:\nError: Browser action 'web_search' failed: list index out of range
  • After this, Manus Agent runs web_search again with the same (or very similar) query:
2025-11-21 14:06:06.049 | INFO     | app.agent.toolcall:think:89 - 🔧 Tool arguments: {"action": "web_search", "query": "2025 AI agent site:arxiv.org"}
2025-11-21 14:06:06.051 | INFO     | app.agent.toolcall:execute_tool:180 - 🔧 Activating tool: 'browser_use'...
2025-11-21 14:06:06.052 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Google...
2025-11-21 14:06:06.705 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Duckduckgo...
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+site%3Aarxiv.org 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+site%3Aarxiv.org&first=11&FORM=PERE 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+site%3Aarxiv.org&first=21&FORM=PERE1 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+site%3Aarxiv.org&first=31&FORM=PERE2 200
INFO     [primp] response: https://www.bing.com/search?q=2025+AI+agent+site%3Aarxiv.org&first=41&FORM=PERE3 200
2025-11-21 14:06:10.682 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Baidu...
2025-11-21 14:06:11.838 | INFO     | app.tool.web_search:_try_all_engines:299 - 🔎 Attempting search with Bing...
2025-11-21 14:06:12.021 | WARNING  | app.tool.web_search:execute:274 - All search engines failed. Waiting 10 seconds before retry 1/3...
  • After the fix:

    • No index error is raised.
    • A clear “all search engines returned no results” error is propagated via tool_message.
    • Manus Agent no longer treats this as an internal crash of browser_use, and the repeated same-query behavior is mitigated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant