saadeghi/daisyui · error · Error

Chrome target discovery failed with HTTP ${response.status}

Error message

Chrome target discovery failed with HTTP ${response.status}

What it means

getPageWebSocketUrl fetches Chrome's DevTools HTTP endpoint at http://127.0.0.1:<port>/json/list to discover the page target. If the response is not ok (status outside 200-299), it throws with the HTTP status. This runs after the browser is up, so a non-ok response means the DevTools HTTP API is reachable but erroring.

Source

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

    this.nextId += 1

    const result = new Promise((resolveResult, rejectResult) => {
      this.pending.set(id, { method, reject: rejectResult, resolve: resolveResult })
    })

    this.socket.send(JSON.stringify({ id, method, params }))
    return result
  }

  close() {
    if (this.socket.readyState === WebSocket.OPEN) this.socket.close()
  }
}

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", {

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Ensure no other Chrome instance is holding the DevTools port (the script uses port 0, but a hijacked host:port can still collide).
  2. Retry the share creation once Chrome has fully settled.
  3. Free resources on the host; check `chrome://version` style output if you can.
Defensive patterns

Strategy: retry

Try / catch

let lastError
for (let attempt = 0; attempt < 3; attempt += 1) {
  try { return await getPageWebSocketUrl(port) }
  catch (error) {
    lastError = error
    if (/Chrome target discovery failed with HTTP/.test(error.message)) { await delay(250); continue }
    throw error
  }
}
throw lastError

Prevention

When it happens

Trigger: Chrome's /json/list returns 5xx (server error) or 4xx; the port was bound by a different service that does not speak the DevTools protocol; Chrome is mid-shutdown.

Common situations: Another process races onto the chosen port (rare with --remote-debugging-port=0); Chrome under memory pressure returning errors; a stale Chrome instance left running on the same profile.

Related errors


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