take_screenshot hangs for 180 s when the Chrome window is minimized (reliable repro for #2459)

Open
#3,598 9 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
64/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
tooling

Research direction

Start from the tool handler that issues Page.captureScreenshot and look at how it currently reports protocol failures and timeouts. Before capturing, query the window state with Browser.getWindowForTarget and return the actionable message from the issue when the window is minimized. The issue suggests covering this with a mock handler test since CI is headless, so read the existing screenshot tool tests to see how CDP responses are mocked; done means the minimized case fails immediately with the new message and the existing capture paths still pass.

Written by the indexing model from the issue text.

Description

confirmed p2
Description of the bug

When the Chrome window is minimized, take_screenshot never returns. After 180 s it fails with Page.captureScreenshot timed out. Increase the 'protocolTimeout' setting..., and other tools on the page wait behind it.

This looks like the cause of #2459. The repro gist there starts with select_page({bringToFront: true}), which restores the window, so the bug never shows up.

Raw CDP shows the same thing without the MCP (Page.captureScreenshot after Browser.setWindowBounds, 60 s cap):

Window Captures hung
in front 0 / 30
covered by another window 0 / 30
minimized 30 / 30
minimized, Chrome started with --disable-backgrounding-occluded-windows --disable-renderer-backgrounding --disable-background-timer-throttling 30 / 30

Each hung capture finished within 2 s after Page.bringToFront. take_snapshot works fine while minimized. This matches puppeteer#12712: a minimized window renders no frames.

Reproduction

The gist from #2459 with two changes: --browserUrl http://127.0.0.1:9222 instead of --auto-connect, and the window is minimized right after the select_page({pageId: 1, bringToFront: true}) line (I used CDP Browser.setWindowBounds {windowState: "minimized"}; minimizing by hand works too). Each take_screenshot had a 20 s client timeout.

  • window normal: 3 / 3 ok (78-525 ms)
  • minimized: 3 / 3 timed out
Expectation

take_screenshot fails at once with an actionable error instead of blocking for 180 s. For example: check the window state with Browser.getWindowForTarget before capturing, and if it is minimized, return "The browser window is minimized, so there is nothing to capture. Restore it or call select_page with bringToFront: true." This can be covered by a mock handler test, since CI is headless.

MCP configuration

npx -y chrome-devtools-mcp@latest --browserUrl http://127.0.0.1:9222

Chrome DevTools MCP version

1.13.0

Chrome version

158.0.8127.36

Coding agent version

Claude Code v2.1.331 (also reproduced with @modelcontextprotocol/client 2.4.0)

Model version

No response

Chat log

No response

Node version

v24.14.1

Operating system

Windows Subsystem for Linux (WSL)

Extra checklist
  • I want to provide a PR to fix this bug
Dominant language
TypeScript
Stars
59.8k
Forks
4.8k
Avg merge
2d 10h
Merged PRs (30d)
162

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ChromeDevTools/chrome-devtools-mcp

All issues in ChromeDevTools/chrome-devtools-mcp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.