{"record":{"id":"77c3c9360a10ed8b","repo":"mastra-ai/mastra","slug":"no-websocketdebuggerurl-found-in-cdp-version-respo-77c3c9","errorCode":null,"errorMessage":"No webSocketDebuggerUrl found in CDP version response from ${versionUrl}","messagePattern":"No webSocketDebuggerUrl found in CDP version response from (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/browser/browser.ts","lineNumber":936,"sourceCode":"      this.logger.debug?.(`Resolving WebSocket URL from ${versionUrl}`);\n\n      // Add timeout to prevent hanging on dead endpoints\n      const controller = new AbortController();\n      const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n      try {\n        const response = await fetch(versionUrl, { signal: controller.signal });\n        clearTimeout(timeoutId);\n\n        if (!response.ok) {\n          throw new Error(\n            `Failed to fetch CDP version info from ${versionUrl}: ${response.status} ${response.statusText}`,\n          );\n        }\n\n        const data = (await response.json()) as { webSocketDebuggerUrl?: string };\n        if (!data.webSocketDebuggerUrl) {\n          throw new Error(`No webSocketDebuggerUrl found in CDP version response from ${versionUrl}`);\n        }\n\n        this.logger.debug?.(`Resolved WebSocket URL: ${data.webSocketDebuggerUrl}`);\n        return data.webSocketDebuggerUrl;\n      } catch (error) {\n        clearTimeout(timeoutId);\n        if (error instanceof Error && error.name === 'AbortError') {\n          throw new Error(`Timeout resolving WebSocket URL from ${versionUrl} (10s)`);\n        }\n        throw error;\n      }\n    }\n\n    // Unknown protocol - return as-is and let the caller handle it\n    return url;\n  }\n\n  // ---------------------------------------------------------------------------","sourceCodeStart":918,"sourceCodeEnd":954,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/browser/browser.ts#L918-L954","documentation":"After fetching the CDP /json/version payload, resolveWebSocketUrl requires a webSocketDebuggerUrl field to know which WebSocket to attach to. If the JSON is valid but lacks that field, it throws. Some gateways or older/patched Chrome builds omit or mask this field.","triggerScenarios":"The /json/version response JSON has no webSocketDebuggerUrl key — e.g. a proxy that rewrites Host headers without fixing the URL, a hardened/patched Chromium, or an intermediary that returns a trimmed version document.","commonSituations":"Docker/Kubernetes setups where Chrome binds 127.0.0.1 and the response advertises an unreachable host (some setups strip the field); proxying through services like Envoy/nginx that alter the JSON; non-Chrome CDP-compatible runtimes.","solutions":["Pass the WebSocket URL directly (ws://host:port/devtools/browser/<id>) instead of the http version URL.","Launch Chrome with --remote-debugging-address=0.0.0.0 (and --remote-debugging-port) so the field is present and reachable.","Remove/fix any proxy that rewrites or strips /json/version fields.","Construct the ws URL manually from the host:port if the endpoint is known."],"exampleFix":"// before\nawait browser.connectToExternalCdp('http://chrome:9222'); // version JSON lacks webSocketDebuggerUrl\n// after\nconst res = await fetch('http://chrome:9222/json/version');\nconst { webSocketDebuggerUrl } = await res.json();\nawait browser.connectToExternalCdp(webSocketDebuggerUrl.replace('127.0.0.1', 'chrome'));","handlingStrategy":"type-guard","validationCode":"const res = await fetch('http://host:9222/json/version');\nconst data: unknown = await res.json();\nif (!isCdpVersionOk(data)) throw new Error('Endpoint does not advertise webSocketDebuggerUrl; pass ws URL manually');","typeGuard":"function isCdpVersionOk(d: unknown): d is { webSocketDebuggerUrl: string } {\n  return typeof d === 'object' && d !== null && typeof (d as any).webSocketDebuggerUrl === 'string' && (d as any).webSocketDebuggerUrl.startsWith('ws');\n}","tryCatchPattern":"try {\n  await browser.connectToExternalCdp('http://chrome:9222');\n} catch (err) {\n  if (err instanceof Error && err.message.includes('No webSocketDebuggerUrl found')) {\n    await browser.connectToExternalCdp('ws://chrome:9222/devtools/browser'); // hand-built URL\n  } else throw err;\n}","preventionTips":["Inspect /json/version output manually once per environment before automating.","Launch Chrome with --remote-debugging-port and a reachable bind address.","Avoid proxies that rewrite the version JSON.","Prefer direct ws:// endpoints in production."],"tags":["cdp","websocket","network","proxy"],"backgroundTag":"missing-cdp-websocket-url","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}