Repository navigation
Description
Description of the bug
Summary
When the currently selected page is closed, the Chrome DevTools MCP session can become unusable.
After that happens, MCP keeps returning:
Error: The selected page has been closed. Call list_pages to see open pages.
The problem is that recovery commands such as list_pages, new_page, and select_page may also fail with the same error, so the session cannot recover even though the browser still has other open pages.
Environment
- Chrome DevTools MCP
- Remote debugging against Android Chrome
- Remote browser discovered through
browser_url=http://127.0.0.1:9223 - The remote browser was still alive and still had open pages after the failure
Reproduction Steps
- Connect Chrome DevTools MCP to a remote Android Chrome instance.
- Open multiple pages so that MCP has an active selected page.
- Close the currently selected page.
- This may happen because of page logic, host behavior, user action, or any other normal page lifecycle.
- Try any MCP page-management command afterwards, such as:
list_pagesnew_pageselect_page
Actual Result
Once the selected page is closed, MCP may enter a broken state.
Subsequent page-related commands fail with:
Error: The selected page has been closed. Call list_pages to see open pages.
In my case, the remote browser still had other available pages, so the browser connection itself was not lost. The issue appears to be that MCP cannot recover after its selected target disappears.
Expected Result
If the selected page is closed, MCP should recover gracefully by doing one of the following:
- allow
list_pagesto work without requiring a valid selected page - automatically fall back to another existing page
- allow
new_pageto create a fresh page even after the selected page is gone - expose a recoverable state instead of locking the whole session
Why This Matters
This blocks real E2E automation for flows where page closure is an expected outcome, including but not limited to:
- child tab close flows
- popup close flows
- success flows that dismiss the current page
- any scenario where the active target disappears during normal automation
In these cases, page closure is valid application behavior, but it currently breaks the MCP session itself.
Additional Notes
The browser was still reachable from the remote debugging endpoint after the failure, which suggests this is not a browser disconnect issue but a session/context recovery issue inside MCP.
Reproduction
No response
Expectation
No response
MCP configuration
No response
Chrome DevTools MCP version
latest
Chrome version
No response
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
None
Extra checklist
- I want to provide a PR to fix this bug
Activity
OrKoN commentedon May 11, 2026
is it the same issue as fixed with #2030?
OrKoN commentedon May 11, 2026
Please specify which chrome-devtools-mcp version you are using.
yuzhanglong commentedon May 11, 2026
0.25.0
yuzhanglong commentedon May 12, 2026
@OrKoN I'm not sure.
OrKoN commentedon May 12, 2026
I am not able to reproduce with 0.26.0 which was released today. Please give it a try.
DerKleineLi commentedon May 12, 2026
Hit this on v0.26.0 with a real OAuth-popup-close flow today; the dispatch-side fix in #2030 doesn't cover the response-build side, so the bug class is still live in that version.
Reproduction on v0.26.0
chrome-devtools-mcpto drive a "Sign in with X" page that uses a Google one-tap popup (e.g.https://x.com/i/flow/loginwhile signed out).select_pagethe OAuth account-chooser popup, click the account, popup self-closes on completion (window.close()from Google's flow). This bypasses MCP's structured close path — same as the OP's "page closure as valid application behavior" scenario.mcp__chrome-devtools__list_pagesreturnsError: The selected page has been closed. Call list_pages to see open pages.Why #2030 wasn't sufficient
#2030 moved
getSelectedMcpPage()inside the'pageScoped' in toolbranch ofsrc/index.ts— fixes the dispatch side. But the response-build pipeline still requires a live selected page to enumeratethirdPartyDeveloperTools+webmcpTools. Stack from the live failure points tosrc/McpResponse.ts:557and:564:list_pagesandselect_pageboth callresponse.setListThirdPartyDeveloperTools()+response.setListWebMcpTools(), so the response builder hits these blocks even though the handlers themselves are selection-independent. With the popup-target dead, the build throws and the call surfaces the same"selected page has been closed"error — making recovery vialist_pages/select_pageimpossible, matching the OP's report.Suggested fix
Wrap the two fallback blocks in
try/catchso enrichment fails silently when there's no valid selection.list_pagesreturns the tab list,select_page(pageId)re-selects, and the dev-tools/webmcp listings just don't appear in those particular responses (which is correct — they're not page-scoped operations).I have this running locally as a JS patch on the built artifact (reference) and verified the full reproducer above turns green post-patch. Happy to file a PR with the TS-side change against
src/McpResponse.tsif helpful — would land cleanly on top of #2030.(Closing #2033 was reasonable given the partial fix; flagging this here rather than opening a new issue since the failure mode is identical.)
Edit 2026-05-12: Retested on pristine v0.26.0 — bug doesn't reproduce with the default registration; my original repro was tainted by a local JS patch I'd applied on first install. Apologies for the confusion.
OrKoN commentedon May 12, 2026
Thanks, that makes sense although listThirdPartyDeveloperTools and listWebMcpTools are disabled by default so unless you have them enabled you should not see an error.
athuljayaram commentedon May 12, 2026
Error: The selected page has been closed. Call list_pages to see open pages.
fix: do not use getSelectedMcpPage (ChromeDevTools#2039)
chore: sync upstream chrome-devtools-mcp 1.2.0 into Brave port (v0.6.…
lueluelue2006 commentedon Aug 18, 2026
This appears to have regressed in
[email protected].I can reproduce it reliably with a clean A/B test against
1.6.0and1.7.0. The reproducer uses a fresh temporary Chrome profile and a scripted raw MCP stdio client. No coding agent, wrapper/bridge,--autoConnect, or--experimentalPageIdRoutingis involved.Environment
--browserUrl http://127.0.0.1:<port>Reproduction
Launch Chrome with an isolated temporary profile and an initial
about:blankpage.Start Chrome DevTools MCP with:
npx -y chrome-devtools-mcp@VERSION --browserUrl http://127.0.0.1:<port> --no-usage-statistics --no-performance-cruxCall
list_pages.Call
new_pagewith a data URL so the new page becomes selected.Close that target externally through Chrome's
/json/close/<targetId>endpoint. This simulates the selected target disappearing because of user action, page logic, or host behavior.Call
list_pagesagain.The same reproduction was run against both package versions.
A/B result
[email protected]succeeds:[email protected]fails:Relevant 1.7.0 log excerpt:
Suspected regression
In 1.7.0,
ToolHandler.handle()collects page context beforeresponse.handle():For
list_pages,pageis undefined because the tool is not page-scoped. If the selected page has already closed,context.getSelectedMcpPage()throws beforeresponse.handle()gets a chance to refresh the page snapshot and apply the existing closed-page fallback.The pre-response page-context lookup appears to have been introduced by commit
6398b7e/ PR #2455 (feat(telemetry): report whether tool call is made on localhost). The same lookup is still present on currentmainas of 2026-08-18.1.6.0does not have this lookup at this point in the handler and recovers correctly in the same test.Telemetry/context collection here should probably be best-effort so it cannot turn a recoverable non-page-scoped tool call into an error. A regression test exercising the complete
ToolHandlerpath after externally closing the selected page would also catch this; invoking only thelist_pageshandler would miss the failure because it happens between the handler andresponse.handle().Could this issue be reopened for the 1.7.0 regression?
OrKoN commentedon Aug 18, 2026
@lueluelue2006 can you please file a new issue as it appears to be a new regression? cc @yulunz
fix: do not append page url when the previously selected page is gone. (
chore: sync upstream chrome-devtools-mcp 1.2.0 into Brave port (v0.6.…