Mintplex-Labs/anything-llm · error

No browser tab matching "${targetUrl}". Open tabs:\n${openTa

Error message

No browser tab matching "${targetUrl}". Open tabs:\n${openTabs}

What it means

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.

Source

Thrown at open-computer/services/interface-service/utils/cdp-input.js:111

    // Determine target URL filter (always last arg if it doesn't look like a coordinate/text)
    let targetUrl = "";
    if (action === "click") {
      targetUrl = process.argv[5] || "";
    } else if (action === "type") {
      targetUrl = process.argv[4] || "";
    } else if (action === "key") {
      targetUrl = process.argv[4] || "";
    }

    let target = pages[pages.length - 1];
    if (targetUrl) {
      const match = pages.find(
        (p) => p.url.includes(targetUrl) || p.title.toLowerCase().includes(targetUrl.toLowerCase())
      );
      if (!match) {
        const openTabs = pages.map((p) => `- ${p.title} ${p.url}`).join("\n");
        throw new Error(`No browser tab matching "${targetUrl}". Open tabs:\n${openTabs}`);
      }
      if (match) target = match;
    }

    const { sessionId } = await cdpSend(ws, "Target.attachToTarget", {
      targetId: target.targetId,
      flatten: true,
    });

    if (action === "click") {
      const x = parseFloat(process.argv[3]);
      const y = parseFloat(process.argv[4]);
      if (isNaN(x) || isNaN(y)) throw new Error("click requires <x> <y> coordinates");

      // Move mouse to position first (triggers hover states)
      await cdpSend(ws, "Input.dispatchMouseEvent", {
        type: "mouseMoved", x, y
      }, sessionId);

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Copy a stable URL substring from the 'Open tabs:' list in the error into the filter argument
  2. Check argument order: click uses <x> <y> [filter], type/key use <text|key> [filter] — the filter is always last
  3. Re-open the intended page or update the filter to the post-redirect URL
  4. Omit the filter to target the most recently used tab

Example fix

# before: filter text consumed in wrong position
node cdp-input.js type 'github.com' 'hello'   # types 'github.com', filters by 'hello'
# after
node cdp-input.js type 'hello' 'github.com'
Defensive patterns

Strategy: validation

Validate before calling

async function pickTabFilter(filter) {
  const pages = (await (await fetch('http://127.0.0.1:9222/json/list')).json())
    .filter((t) => t.type === 'page' && !t.url.startsWith('chrome://'));
  return pages.some((p) => p.url.includes(filter) || p.title.toLowerCase().includes(filter.toLowerCase()))
    ? filter
    : undefined; // fall back to 'most recent tab' behavior
}

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/78d7efb2b0bd0b5b. Report an issue: GitHub.