{"record":{"id":"78d7efb2b0bd0b5b","repo":"Mintplex-Labs/anything-llm","slug":"no-browser-tab-matching-targeturl-open-tabs-78d7ef","errorCode":null,"errorMessage":"No browser tab matching \"${targetUrl}\". Open tabs:\\n${openTabs}","messagePattern":"No browser tab matching \"(.+?)\"\\. Open tabs:\\\\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-computer/services/interface-service/utils/cdp-input.js","lineNumber":111,"sourceCode":"\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\");\n        throw new Error(`No browser tab matching \"${targetUrl}\". Open tabs:\\n${openTabs}`);\n      }\n      if (match) target = match;\n    }\n\n    const { sessionId } = await cdpSend(ws, \"Target.attachToTarget\", {\n      targetId: target.targetId,\n      flatten: true,\n    });\n\n    if (action === \"click\") {\n      const x = parseFloat(process.argv[3]);\n      const y = parseFloat(process.argv[4]);\n      if (isNaN(x) || isNaN(y)) throw new Error(\"click requires <x> <y> coordinates\");\n\n      // Move mouse to position first (triggers hover states)\n      await cdpSend(ws, \"Input.dispatchMouseEvent\", {\n        type: \"mouseMoved\", x, y\n      }, sessionId);","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/open-computer/services/interface-service/utils/cdp-input.js#L93-L129","documentation":"cdp-input's tab-selection failure: the optional trailing targetUrl argument (argv[4] for click, argv[4]... actually argv[5] for click / argv[4] for type and key) matched no open page by URL substring or case-insensitive title substring, so there is no page to receive the input events. The message enumerates open tabs (title + URL) so the correct selector is visible.","triggerScenarios":"Running e.g. `node cdp-input.js click 320 240 github.com` when no tab URL/title contains 'github.com'; passing the text argument's position wrong so a coordinate/text is consumed as the tab filter; the intended tab navigated (login redirect, SPA route change) so the old fragment no longer matches.","commonSituations":"Argument-order mistakes in the click/type/key CLI (filter is the LAST arg and positional); stale selectors after redirects; titles that changed language or content since the selector was written.","solutions":["Copy a stable URL substring from the 'Open tabs:' list in the error into the filter argument","Check argument order: click uses <x> <y> [filter], type/key use <text|key> [filter] — the filter is always last","Re-open the intended page or update the filter to the post-redirect URL","Omit the filter to target the most recently used tab"],"exampleFix":"# before: filter text consumed in wrong position\nnode cdp-input.js type 'github.com' 'hello'   # types 'github.com', filters by 'hello'\n# after\nnode cdp-input.js type 'hello' 'github.com'","handlingStrategy":"validation","validationCode":"async function pickTabFilter(filter) {\n  const pages = (await (await fetch('http://127.0.0.1:9222/json/list')).json())\n    .filter((t) => t.type === 'page' && !t.url.startsWith('chrome://'));\n  return pages.some((p) => p.url.includes(filter) || p.title.toLowerCase().includes(filter.toLowerCase()))\n    ? filter\n    : undefined; // fall back to 'most recent tab' behavior\n}","typeGuard":null,"tryCatchPattern":"try { await sendInput(action, ...args, filter); } catch (e) { if (/No browser tab matching/.test(e.message)) { /* choose a new filter from the printed tab list or omit it, retry once */ } else throw e; }","preventionTips":["Remember the argument order: the tab filter is always the LAST argument for click/type/key","Use stable URL substrings (hostname + path fragment) as filters, never volatile titles","In wrappers, verify the filter against /json/list before spawning the helper to avoid a wasted process"],"tags":["chrome","cdp","tab-targeting","cli-args","open-computer"],"backgroundTag":"cdp-tab-not-found","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}