Repository navigation
Description
Summary
With --extension on a multi-profile Chrome setup, the first browser tool call can wait indefinitely when connect.html lands in a different profile from the one whose extension token was configured.
This is especially reproducible when a person is using Chrome at the same time: starting a fresh MCP/client session resets the stuck server-side promise, but does not remove the race over which Chrome profile/window receives the connect page.
Environment
- macOS, Chrome with multiple profiles
- One account per Chrome profile
- Playwright extension installed in multiple profiles, with a different extension token per profile
@playwright/mcp0.0.79- Invocation uses
--extension
Observed behavior
On the first browser tool call, MCP launches Chrome with a chrome-extension://.../connect.html URL and waits for _extensionConnectionPromise.
When that URL is opened in the last-active Chrome profile/window rather than the intended profile:
- The extension token does not match.
- The WebSocket connection is never established.
- No extension disconnect event fires because there was no connection to disconnect.
- The promise has no timeout, so the tool call neither succeeds nor returns an explicit error.
- Retrying in the same session waits on the same unresolved promise.
In one run today this failed three times in a row:
- Initial tool call in an interactive session.
- Retry in the same session.
- A new client session (
claude -p) and a new MCP server session.
The new session cleared the previously stuck server state, but the connect page again landed in the wrong profile while Chrome was being actively used.
Expected behavior
Either:
- Allow the extension profile to be selected explicitly, for example with
--profile-directory/--browser-profile(or a config/environment equivalent), and pass it through deterministically; or - Put a finite timeout around the extension connection wait and return a clear error such as "Playwright extension did not connect; check the selected Chrome profile and extension token."
Ideally both would be supported. Explicit profile selection prevents the race; a timeout makes remaining failures diagnosable and lets the client recover.
Why this differs from related reports
Related: #1712, which fixed false-positive profile detection caused by leftovers from an uninstalled extension and also requested explicit profile selection.
This case does not depend on uninstall leftovers: the extension is genuinely installed in multiple profiles. The ambiguity is therefore real, and a human changing the active Chrome profile can make repeated fresh sessions lose in the same way.
Operational impact
A client-level 120-second timeout only stops the caller from waiting; it does not resolve the server-side connection promise. Without an explicit profile selector or a server-side timeout/error, the session is effectively unrecoverable and the next fresh session can immediately hit the same race again.
Activity
noagogo commentedon Sep 3, 2026
Thank you for the incredibly fast turnaround, Yury Semikhatsky (@yury-s) — both PRs land exactly on the two failure modes I hit:
--profile-dir-name/PLAYWRIGHT_MCP_PROFILE_DIR_NAME) fixes the root cause — I run several Chrome profiles that each have the extension installed with a per-identity token, and the connect page landing in the "last used" profile instead of the token's profile was the trigger.This is a daily config for me, so both are very welcome. Thanks again.