{"record":{"id":"3b21b06cec1288c4","repo":"saadeghi/daisyui","slug":"chrome-did-not-expose-a-page-devtools-socket","errorCode":null,"errorMessage":"Chrome did not expose a page DevTools socket","messagePattern":"Chrome did not expose a page DevTools socket","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/index.mjs","lineNumber":425,"sourceCode":"}\n\nasync function getPageWebSocketUrl(port) {\n  const endpoint = `http://127.0.0.1:${port}`\n  let response = await fetch(`${endpoint}/json/list`)\n  if (!response.ok) throw new Error(`Chrome target discovery failed with HTTP ${response.status}`)\n\n  let targets = await response.json()\n  let page = targets.find((target) => target.type === \"page\" && target.webSocketDebuggerUrl)\n\n  if (!page) {\n    response = await fetch(`${endpoint}/json/new?${encodeURIComponent(\"about:blank\")}`, {\n      method: \"PUT\",\n    })\n    if (!response.ok) throw new Error(`Chrome page creation failed with HTTP ${response.status}`)\n    page = await response.json()\n  }\n\n  if (!page.webSocketDebuggerUrl) throw new Error(\"Chrome did not expose a page DevTools socket\")\n  return page.webSocketDebuggerUrl\n}\n\nasync function evaluate(client, expression) {\n  const response = await client.send(\"Runtime.evaluate\", {\n    awaitPromise: true,\n    expression,\n    returnByValue: true,\n    userGesture: true,\n  })\n\n  if (response.exceptionDetails) {\n    const description =\n      response.exceptionDetails.exception?.description ??\n      response.exceptionDetails.text ??\n      \"Unknown page evaluation error\"\n    throw new Error(description)\n  }","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/index.mjs#L407-L443","documentation":"Thrown by getPageWebSocketUrl when a page target was found or created but its JSON descriptor has no webSocketDebuggerUrl field. The script needs that URL to open the CDP WebSocket it drives the page with, so it cannot proceed without it.","triggerScenarios":"targets.find(...) returns a target whose type is \"page\" but webSocketDebuggerUrl is missing, or the PUT /json/new response body lacks the field. The subsequent guard `if (!page.webSocketDebuggerUrl)` fires.","commonSituations":"Chrome exposed a target of type \"page\" that is actually an internal/preview target without a debug socket, a browser extension or app target masquerading as a page, or an older Chromium build that omits webSocketDebuggerUrl for service-worker/other targets. Rare; usually indicates an unusual Chrome build.","solutions":["Use a standard Google Chrome or Chromium stable build rather than an embedded/WebView or vendor fork.","Close other Chrome instances that may have grabbed the user-data-dir targets before retrying.","Pass --browser to point at a known-good chrome executable.","Retry createTailwindPlay; a fresh profile usually yields a clean page target."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  url = await createTailwindPlay(inputs)\n} catch (error) {\n  if (error.message === \"Chrome did not expose a page DevTools socket\") {\n  // retry with a fresh profile; surface a clearer message if it persists\n  }\n  throw error\n}","preventionTips":["Use mainstream Chrome/Chromium builds; vendor forks may omit webSocketDebuggerUrl.","Ensure no other Chrome instance is reusing the temp profile directory.","Retry createTailwindPlay once before treating it as a hard failure."],"tags":["chrome-devtools","cdp","browser-automation","target"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}