{"record":{"id":"33a344ebe68e37a4","repo":"saadeghi/daisyui","slug":"chrome-target-discovery-failed-with-http-respons","errorCode":null,"errorMessage":"Chrome target discovery failed with HTTP ${response.status}","messagePattern":"Chrome target discovery failed with HTTP (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/index.mjs","lineNumber":412,"sourceCode":"    this.nextId += 1\n\n    const result = new Promise((resolveResult, rejectResult) => {\n      this.pending.set(id, { method, reject: rejectResult, resolve: resolveResult })\n    })\n\n    this.socket.send(JSON.stringify({ id, method, params }))\n    return result\n  }\n\n  close() {\n    if (this.socket.readyState === WebSocket.OPEN) this.socket.close()\n  }\n}\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\", {","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/index.mjs#L394-L430","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure no other Chrome instance is holding the DevTools port (the script uses port 0, but a hijacked host:port can still collide).","Retry the share creation once Chrome has fully settled.","Free resources on the host; check `chrome://version` style output if you can."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"let lastError\nfor (let attempt = 0; attempt < 3; attempt += 1) {\n  try { return await getPageWebSocketUrl(port) }\n  catch (error) {\n    lastError = error\n    if (/Chrome target discovery failed with HTTP/.test(error.message)) { await delay(250); continue }\n    throw error\n  }\n}\nthrow lastError","preventionTips":["Ensure no other Chrome instance occupies the DevTools port.","Retry once - transient 5xx from /json/list usually clears.","Keep a single share-creation in flight at a time."],"tags":["browser","devtools","network","chrome","http"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}