{"record":{"id":"a460604ffbf9305c","repo":"Mintplex-Labs/anything-llm","slug":"no-browser-pages-open-a46060","errorCode":null,"errorMessage":"No browser pages open.","messagePattern":"No browser pages open\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-computer/services/interface-service/utils/cdp-input.js","lineNumber":92,"sourceCode":"  const versionRaw = await httpGet(\"http://127.0.0.1:9222/json/version\");\n  const version = JSON.parse(versionRaw);\n  const browserWsUrl = version.webSocketDebuggerUrl;\n  if (!browserWsUrl) throw new Error(\"No webSocketDebuggerUrl — is Chromium running?\");\n\n  const ws = await new Promise((resolve, reject) => {\n    const socket = new WebSocket(browserWsUrl);\n    const t = setTimeout(() => reject(new Error(\"WS connect timeout\")), 5000);\n    socket.on(\"open\", () => { clearTimeout(t); resolve(socket); });\n    socket.on(\"error\", (err) => { clearTimeout(t); reject(err); });\n  });\n\n  try {\n    // Find target page\n    const { targetInfos } = await cdpSend(ws, \"Target.getTargets\");\n    const pages = targetInfos.filter(\n      (t) => t.type === \"page\" && !t.url.startsWith(\"chrome://\") && !t.url.startsWith(\"devtools://\")\n    );\n    if (pages.length === 0) throw new Error(\"No browser pages open.\");\n\n    // Determine target URL filter (always last arg if it doesn't look like a coordinate/text)\n    let targetUrl = \"\";\n    if (action === \"click\") {\n      targetUrl = process.argv[5] || \"\";\n    } else if (action === \"type\") {\n      targetUrl = process.argv[4] || \"\";\n    } else if (action === \"key\") {\n      targetUrl = process.argv[4] || \"\";\n    }\n\n    let target = pages[pages.length - 1];\n    if (targetUrl) {\n      const match = pages.find(\n        (p) => p.url.includes(targetUrl) || p.title.toLowerCase().includes(targetUrl.toLowerCase())\n      );\n      if (!match) {\n        const openTabs = pages.map((p) => `- ${p.title} ${p.url}`).join(\"\\n\");","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/open-computer/services/interface-service/utils/cdp-input.js#L74-L110","documentation":"cdp-input sibling of cdp-eval's page check: after Target.getTargets, pages are filtered to type 'page' excluding chrome:// and devtools:// URLs; if none remain, input injection has no target and the helper aborts with this error. The connection and WS handshake succeeded — the browser simply exposes no regular web page to attach to.","triggerScenarios":"Attempting click/type/key immediately after launching Chromium whose only tab is the new-tab page; the user (or page JS) closed all regular tabs; every open tab is a chrome:// internal page.","commonSituations":"Startup race where input is dispatched before the agent's start page finishes opening; kiosk/new-profile Chromium instances sitting on NTP; sessions where the page crashed and Chrome shows the sad-tab chrome://crash page.","solutions":["Navigate to or open a real http/https page, then retry the input command","Add a small retry/delay right after browser launch until /json/list shows a page-type target with a non-chrome:// URL","Set the agent's launch URL to a real page so a valid target always exists at startup","Reopen crashed tabs (chrome://restore is filtered too — navigate explicitly) before injecting input"],"exampleFix":"# before\nchromium --remote-debugging-port=9222 --user-data-dir=/tmp/oc-chrome &\nnode cdp-input.js click 100 200      # NTP only -> error\n# after: launch straight into a page\nchromium --remote-debugging-port=9222 --user-data-dir=/tmp/oc-chrome https://example.com &\nnode cdp-input.js click 100 200","handlingStrategy":"validation","validationCode":"async function hasAttachablePage() {\n  const targets = await (await fetch('http://127.0.0.1:9222/json/list')).json();\n  return targets.some((t) => t.type === 'page' && !t.url.startsWith('chrome://') && !t.url.startsWith('devtools://'));\n}","typeGuard":null,"tryCatchPattern":"try { await sendInput('click', x, y); } catch (e) { if (/No browser pages open/.test(e.message)) { await openPage('https://example.com'); await sendInput('click', x, y); } else throw e; }","preventionTips":["Start Chromium with an http(s) URL argument so the NTP filter never empties the page list","Retry once after a short delay at startup — page targets appear asynchronously after launch","Guard scripts that close tabs so the last regular page is never closed"],"tags":["chrome","cdp","targets","input-injection","open-computer"],"backgroundTag":"cdp-no-page-targets","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}