You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: take_screenshot times out (MCP -32001) when called immediately after navigate_page
Summary
take_screenshot reliably times out with MCP error -32001: Request timed out when called immediately after navigate_page. Waiting 5-6 seconds before the screenshot makes it succeed 100% of the time. evaluate_script on the same freshly-navigated page works fine, and direct CDP screenshots (bypassing the MCP server) complete in ~100ms.
Updated root cause (after controlled testing, see comments): the failure is an internal race/lock contention in the server right after navigation — when take_screenshot arrives while the post-navigation render-stabilization wait (see #2426waitForStableDom mutex stall and #2338) is still settling, the screenshot request blocks until the MCP client's request timeout fires. This is reproducible in a fresh process with low memory, so memory leak (#2431) is NOT the cause of this specific symptom.
Reproducible both in opencode (4/4 immediate failures) and with an independent MCP client (round 2 of navigation→screenshot hung >30s while round 1 completed in 70ms).
Timeline of measurements
Scenario
Result
navigate_page → take_screenshot immediately
❌ -32001 timeout (4/4)
navigate_page → wait 2s → take_screenshot
❌ still timeout
navigate_page → wait 5-6s → take_screenshot
✅ success (100%)
navigate_page → evaluate_script immediately
✅ success (unaffected)
Direct CDP Page.captureScreenshot on same page
✅ 89-107ms, all success
Independent MCP client, fresh process, round 1
✅ 70ms
Independent MCP client, fresh process, round 2
❌ hung >30s (client timeout)
Additional observations
CDP-layer screenshots are fast (89-190ms) even on pages with heavy DOM churn (setInterval mutating DOM every 5ms), so Chrome/rendering itself is not slow.
Once the page is settled, consecutive screenshots (PNG/JPEG/WebP, inline or filePath) all succeed reliably.
The failure appears specific to the window right after navigation while the page is still loading/settling. evaluate_script does not suffer because it does not wait for render stabilization.
In-session failures consistently take exactly the client timeout (60s in opencode, 30s in my independent client) and then succeed on retry after the page settles — consistent with a blocked/stalled wait rather than slow processing.
Could the post-navigation wait used by take_screenshot (and possibly other render-dependent tools) be bounded by a configurable/server-side timeout or made non-blocking (e.g., proceed without waiting for full render stabilization, or serialize against the navigation wait without holding the client hostage)? Happy to provide DEBUG logs (DEBUG=* --logFile) on the next hang if that would help pinpoint the lock.
Bug:
take_screenshottimes out (MCP -32001) when called immediately afternavigate_pageSummary
take_screenshotreliably times out withMCP error -32001: Request timed outwhen called immediately afternavigate_page. Waiting 5-6 seconds before the screenshot makes it succeed 100% of the time.evaluate_scripton the same freshly-navigated page works fine, and direct CDP screenshots (bypassing the MCP server) complete in ~100ms.Updated root cause (after controlled testing, see comments): the failure is an internal race/lock contention in the server right after navigation — when
take_screenshotarrives while the post-navigation render-stabilization wait (see #2426waitForStableDommutex stall and #2338) is still settling, the screenshot request blocks until the MCP client's request timeout fires. This is reproducible in a fresh process with low memory, so memory leak (#2431) is NOT the cause of this specific symptom.Environment
npx -y chrome-devtools-mcp@latest --autoConnect)Steps to reproduce
--autoConnect(Chrome already running with remote debugging).navigate_page(url:https://example.com) — succeeds.take_screenshot(format: png) — fails with -32001 Request timed out.Reproducible both in opencode (4/4 immediate failures) and with an independent MCP client (round 2 of navigation→screenshot hung >30s while round 1 completed in 70ms).
Timeline of measurements
navigate_page→take_screenshotimmediatelynavigate_page→ wait 2s →take_screenshotnavigate_page→ wait 5-6s →take_screenshotnavigate_page→evaluate_scriptimmediatelyPage.captureScreenshoton same pageAdditional observations
evaluate_scriptdoes not suffer because it does not wait for render stabilization.evaluate_scriptcalls to skip the stable DOM wait #2338).Request
Could the post-navigation wait used by
take_screenshot(and possibly other render-dependent tools) be bounded by a configurable/server-side timeout or made non-blocking (e.g., proceed without waiting for full render stabilization, or serialize against the navigation wait without holding the client hostage)? Happy to provide DEBUG logs (DEBUG=* --logFile) on the next hang if that would help pinpoint the lock.