saadeghi/daisyui · error · Error

Chrome did not expose a page DevTools socket

Error message

Chrome did not expose a page DevTools socket

What it means

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.

Source

Thrown at packages/tailwind-play-share/index.mjs:425

}

async function getPageWebSocketUrl(port) {
  const endpoint = `http://127.0.0.1:${port}`
  let response = await fetch(`${endpoint}/json/list`)
  if (!response.ok) throw new Error(`Chrome target discovery failed with HTTP ${response.status}`)

  let targets = await response.json()
  let page = targets.find((target) => target.type === "page" && target.webSocketDebuggerUrl)

  if (!page) {
    response = await fetch(`${endpoint}/json/new?${encodeURIComponent("about:blank")}`, {
      method: "PUT",
    })
    if (!response.ok) throw new Error(`Chrome page creation failed with HTTP ${response.status}`)
    page = await response.json()
  }

  if (!page.webSocketDebuggerUrl) throw new Error("Chrome did not expose a page DevTools socket")
  return page.webSocketDebuggerUrl
}

async function evaluate(client, expression) {
  const response = await client.send("Runtime.evaluate", {
    awaitPromise: true,
    expression,
    returnByValue: true,
    userGesture: true,
  })

  if (response.exceptionDetails) {
    const description =
      response.exceptionDetails.exception?.description ??
      response.exceptionDetails.text ??
      "Unknown page evaluation error"
    throw new Error(description)
  }

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Use a standard Google Chrome or Chromium stable build rather than an embedded/WebView or vendor fork.
  2. Close other Chrome instances that may have grabbed the user-data-dir targets before retrying.
  3. Pass --browser to point at a known-good chrome executable.
  4. Retry createTailwindPlay; a fresh profile usually yields a clean page target.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  url = await createTailwindPlay(inputs)
} catch (error) {
  if (error.message === "Chrome did not expose a page DevTools socket") {
  // retry with a fresh profile; surface a clearer message if it persists
  }
  throw error
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/3b21b06cec1288c4. Report an issue: GitHub.