NanmiCoder/MediaCrawler · error · RuntimeError
webSocketDebuggerUrl not found
Error message
webSocketDebuggerUrl not found
What it means
Error "webSocketDebuggerUrl not found" thrown in NanmiCoder/MediaCrawler.
Source
Thrown at tools/cdp_browser.py:306
async def _get_browser_websocket_url(self, debug_port: int) -> str:
"""
Get browser WebSocket connection URL
"""
try:
async with httpx.AsyncClient() as client:
response = await client.get(
f"http://localhost:{debug_port}/json/version", timeout=10
)
if response.status_code == 200:
data = response.json()
ws_url = data.get("webSocketDebuggerUrl")
if ws_url:
utils.logger.info(
f"[CDPBrowserManager] Got browser WebSocket URL: {ws_url}"
)
return ws_url
else:
raise RuntimeError("webSocketDebuggerUrl not found")
else:
raise RuntimeError(f"HTTP {response.status_code}: {response.text}")
except Exception as e:
utils.logger.error(f"[CDPBrowserManager] Failed to get WebSocket URL: {e}")
raise
async def _connect_via_cdp(self, playwright: Playwright):
"""
Connect to browser via CDP
"""
try:
if config.CDP_CONNECT_EXISTING:
# Existing browser remote debugging in Chrome 136+ does not expose
# /json/version. Connect directly and wait for user confirmation.
ws_url = f"ws://localhost:{self.debug_port}/devtools/browser"
utils.logger.info(f"[CDPBrowserManager] Connecting to existing browser via CDP: {ws_url}")
utils.logger.info(
"[CDPBrowserManager] Please check your browser for a confirmation dialog and accept it"View on GitHub (pinned to d6f7c5bb90)
Solutions
- Restart the browser with remote debugging enabled: launch Chrome/Edge with --remote-debugging-port=<CDP_DEBUG_PORT> and no other Chrome instance using the same profile.
- Verify the debug endpoint manually: curl http://localhost:<CDP_DEBUG_PORT>/json/version and confirm the JSON contains webSocketDebuggerUrl.
- Check that CDP_DEBUG_PORT in config matches the port the browser was actually started with, and that no firewall or other process is interfering with localhost access.
- If using Chrome 136+, the /json/version endpoint may not expose webSocketDebuggerUrl for existing instances; connect directly to ws://localhost:<port>/devtools/browser or relaunch the browser via the launcher.
When it happens
Trigger: Thrown at tools/cdp_browser.py:306 when the library encounters an invalid state.
Common situations: The HTTP request to http://localhost:<debug_port>/json/version returned 200 but the JSON body lacks 'webSocketDebuggerUrl'. Happens with Chrome 136+ where remote debugging no longer exposes /json/version, when the browser was started without --remote-debugging-port, or when a non-browser service occupies the port. Defensive fix: verify the debug port serves a real Chrome DevTools endpoint before parsing, and fall back to the direct ws://localhost:<port>/devtools/browser connection.
AI-assisted analysis of NanmiCoder/MediaCrawler@d6f7c5bb90 (2026-08-15).
Data as JSON: /api/errors/05715c940ade6ca8.
Report an issue: GitHub.