preview_screenshot times out (30s) when serving static HTML via python http.server
Description
preview_screenshot consistently times out after 30 seconds when the dev server is a Python http.server serving a static HTML site. All other preview tools work correctly in the same session.
Steps to reproduce
- Create a
.claude/launch.jsonwith a Python HTTP server:
``json``
{
"version": "0.0.1",
"configurations": [
{ "name": "site", "runtimeExecutable": "python", "runtimeArgs": ["-m", "http.server", "3457"], "port": 3457 }
]
}
- Call
preview_start→ succeeds - Call
preview_snapshot→ succeeds (returns full accessibility tree) - Call
preview_console_logs→ succeeds (no errors) - Call
preview_network→ succeeds (images and fonts load fine; JS eval confirmsimg.naturalWidth > 0) - Call
preview_screenshot→ times out after 30s
Expected behavior
preview_screenshot should return a JPEG of the rendered page, just like preview_snapshot does.
Actual behavior
preview_screenshot timed out after 30s. The preview window may be stuck (modal dialog, navigation hang, or unresponsive renderer).
No errors in console. No failed network requests (except a GA POST which is expected to fail on localhost). The page renders and is fully interactive.
Environment
- OS: Windows 11 Pro 10.0.26200
- Shell: bash (Git Bash)
- Claude Code version: current
- Server:
python -m http.server 3457(Python 3.x) - Page: Static HTML with Alpine.js, Tailwind CSS (pre-built), inline SVGs — no heavy JS
Impact
Cannot visually verify UI changes via screenshot in the verification workflow. All other preview tools work normally.
Workaround
Use preview_snapshot (accessibility tree) to verify content and structure. preview_eval + DOM queries to check specific elements.
Notes
preview_screenshotseems to fail only for this server type. May be related to how Chromium waits for the page to be "ready" before screenshotting, and Python's http.server doesn't set certain response headers that signal completion.- Possible fix: add a configurable timeout or a "page idle" heuristic instead of relying on a navigation event.
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗