{"record":{"id":"32de0624f10f6648","repo":"mastra-ai/mastra","slug":"no-websocketdebuggerurl-found-in-cdp-version-respo","errorCode":null,"errorMessage":"No webSocketDebuggerUrl found in CDP version response from ${versionUrl}","messagePattern":"No webSocketDebuggerUrl found in CDP version response from (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browser/firecrawl/src/resolve-cdp.ts","lineNumber":32,"sourceCode":"    const versionUrl = `${baseUrl}/json/version`;\n\n    logger?.debug?.(`Resolving WebSocket URL from ${versionUrl}`);\n\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\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      logger?.debug?.(`Resolved WebSocket URL: ${data.webSocketDebuggerUrl}`);\n      return data.webSocketDebuggerUrl;\n    } catch (error) {\n      if (error instanceof Error && error.name === 'AbortError') {\n        throw new Error(`Timeout resolving WebSocket URL from ${versionUrl} (10s)`);\n      }\n      throw error;\n    } finally {\n      clearTimeout(timeoutId);\n    }\n  }\n\n  return url;\n}\n","sourceCodeStart":14,"sourceCodeEnd":49,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/browser/firecrawl/src/resolve-cdp.ts#L14-L49","documentation":"After a successful HTTP fetch of the CDP /json/version endpoint, the library expects a webSocketDebuggerUrl field in the JSON response. If the response parses but lacks this field, it throws, because without the WebSocket debugger URL there is no way to attach to the browser. This indicates the endpoint answered but did not expose a connectable browser.","triggerScenarios":"Constructor or wsUrl call where the CDP version endpoint returns JSON without webSocketDebuggerUrl — e.g. an intermediate gateway/proxy returns its own JSON, or the remote browser is not actually running.","commonSituations":"Firecrawl session terminated so the URL now points at a load balancer or error page that still returns JSON; wrong apiUrl hitting a non-CDP service; CDN/proxy stripping the field.","solutions":["Create a new Firecrawl browser session and retry — the old one is likely dead","Verify versionUrl/apiUrl actually points at a Chrome DevTools Protocol endpoint","Log/inspect the raw response body to see what was returned instead","Check for proxies or custom apiUrl mangling the CDP response"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const res = await fetch(versionUrl);\nconst data = await res.json();\nif (!data.webSocketDebuggerUrl) console.error('Endpoint is not a CDP server:', data);","typeGuard":"function isCdpVersion(v: unknown): v is { webSocketDebuggerUrl: string } {\n  return typeof v === 'object' && v !== null && 'webSocketDebuggerUrl' in v &&\n    typeof (v as any).webSocketDebuggerUrl === 'string';\n}","tryCatchPattern":"try {\n  const browser = new FirecrawlBrowser(config);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('No webSocketDebuggerUrl')) {\n    await recreateBrowserSession(); // endpoint answered but no browser attached\n  } else throw e;\n}","preventionTips":["Point apiUrl at the actual CDP endpoint, not a proxy/error page","Create fresh sessions rather than caching version URLs","Log the raw JSON response when the error occurs","Avoid intermediaries that rewrite CDP responses"],"tags":["network","cdp","browser","response-shape"],"backgroundTag":"cdp-websocket-url-missing","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}