-
Notifications
You must be signed in to change notification settings - Fork 2.5k
browser_navigate retry loop spawns multiple about:blank tabs when profile is locked #1311
Copy link
Copy link
Closed
microsoft/playwright
#39377Description
Environment
- OS: macOS 14.x
- Playwright MCP: latest (via
npx @playwright/mcp@latest) - Client: Claude Code
Describe the bug
When the browser profile is already in use (e.g., Chrome wasn't fully killed from a previous session), browser_navigate enters a retry loop that spawns 5+ about:blank tabs before finally throwing the "Browser is already in use" error.
To Reproduce
- Start a Playwright MCP session, navigate to a page
- Kill the MCP client without calling
browser_close(simulating a crash or forced quit) - Start a new MCP session and call
browser_navigate - Observe: 5-6
about:blanktabs open in rapid succession before the error is thrown
Expected behavior
The MCP should check if the profile is available before attempting to launch a browser instance. If locked, fail immediately with a clear error - don't retry in a loop that creates visible side effects.
Current behavior
The retry loop in browserContextFactory.ts catches ProcessSingleton/exitCode=21 errors and retries up to 5 times. Each retry appears to spawn a new tab before failing, resulting in multiple about:blank tabs.
Suggested fix
- Pre-flight check for Chrome's
SingletonLockfile before launching - If lock exists, check if the owning PID is still alive (stale lock detection)
- Fail fast with actionable error instead of retry loop
Workaround
Kill all Chrome processes before starting a new session:
pkill -9 -f "Chromium" 2>/dev/null || true
pkill -9 -f "chrome" 2>/dev/null || trueRelated Issues
- asking to open a page opens 10 tabs
about:blank#845 - "Opens 10 about:blank tabs" - Bug Report: Browser state not properly released after browser_close #1245 - Browser state not released after browser_close
- The agent opens 1000 Tabs and keeps failing after the first attempt worked #1299 - Agent opens 1000 tabs and keeps failing
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels