{"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":"Error","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/526360e320da9d1b36074be5ed64fe76e5bbfbbd/open-computer/services/interface-service/utils/cdp-input.js#L74-L110","documentation":"Thrown by the CDP (Chrome DevTools Protocol) input dispatcher after it successfully connects to Chromium's debugging WebSocket and calls Target.getTargets. It filters the returned targets to real pages (type === 'page', url not starting with chrome:// or devtools://); if every tab is an internal browser page the list is empty and this fires. It is a precondition check that a user-navigable page exists before dispatching mouse/keyboard input.","triggerScenarios":"Running `node cdp-input.js <action>` while Chromium has only chrome://newtab, chrome://settings, or devtools:// tabs open. Also occurs right after launch before any http(s) page has loaded, or when the browser was started headless with no initial URL.","commonSituations":"Chromium launched with --headless and no --app/index URL; the test harness opened the browser but navigation to the target URL failed or was blocked; a previous run closed the last real tab; Chrome restarted and restored only internal pages.","solutions":["Open a real page in the target Chromium first (navigate to any http/https URL) before invoking cdp-input.js.","Launch Chromium with an initial URL: `chromium --remote-debugging-port=9222 https://example.com`.","Verify with `curl http://127.0.0.1:9222/json` that at least one entry has type 'page' and a non-internal URL.","If running headless, pass the page URL at startup since you cannot open tabs interactively."],"exampleFix":"// before\nchromium --headless --remote-debugging-port=9222\n// after\nchromium --headless --remote-debugging-port=9222 https://your-app.test","handlingStrategy":"validation","validationCode":"const http = require('http');\nhttpGet('http://127.0.0.1:9222/json').then((body) => {\n  const targets = JSON.parse(body);\n  const realPages = targets.filter(\n    (t) => t.type === 'page' && !t.url.startsWith('chrome://') && !t.url.startsWith('devtools://')\n  );\n  if (realPages.length === 0) throw new Error('Open a real page in Chromium before running cdp-input');\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Launch Chromium with an initial http(s) URL so a real page always exists.","In CI, assert /json returns at least one non-internal page before invoking cdp-input.","Keep the cdp-input invocation behind a preflight check of /json."],"tags":["cdp","browser-automation","precondition","chromium"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}