Skip to content

fix(tools): wrap browser provider network calls with error handling#2753

Closed
nidhi-singh02 wants to merge 1 commit into
NousResearch:mainfrom
nidhi-singh02:fix/unprotected-network-calls
Closed

fix(tools): wrap browser provider network calls with error handling#2753
nidhi-singh02 wants to merge 1 commit into
NousResearch:mainfrom
nidhi-singh02:fix/unprotected-network-calls

Conversation

@nidhi-singh02

Copy link
Copy Markdown
Contributor

Summary

  • Wrap requests.post() in tools/browser_providers/browser_use.py with requests.RequestException handling
  • Wrap all requests.post() calls (including 402 retry logic) in tools/browser_providers/browserbase.py
  • Connection failures now surface as clear RuntimeError messages instead of raw stack traces

Closes #2746

Test Plan

  • Disconnect network and attempt to create a Browser Use session — verify clear error message
  • Disconnect network and attempt to create a Browserbase session — verify clear error message
  • Verify normal browser session creation still works when API is reachable

Platforms Tested

  • macOS

Catches requests.RequestException in browser_use and browserbase
providers so connection timeouts and DNS failures surface as
clear RuntimeError messages instead of raw stack traces.
@teknium1

Copy link
Copy Markdown
Contributor

Salvaged into PR #26247 (merged). Your fix was reapplied to current main — browser_use.py had been rewritten with managed-gateway support since you opened this — and widened to cover firecrawl.py which had the same bug class. One small divergence: managed-gateway timeout still propagates raw so the existing idempotency-key retry semantics keep working; direct-mode calls wrap into RuntimeError as you proposed. Your authorship is preserved in git log. Thanks!

#26247

@teknium1 teknium1 closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unprotected network calls in browser providers crash on connection failure

3 participants