Mintplex-Labs/anything-llm · error · Error

No browser tab matching "${targetUrl}". Open tabs: ${openTab

Error message

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

What it means

Thrown when an optional target_url argument is supplied to cdp-input.js but none of the open page targets match it. Matching is case-insensitive on the page title substring OR case-sensitive on the URL substring. The error message lists every open tab (title + url) so the caller can correct the filter. It prevents input from being dispatched to the wrong tab when a specific tab was requested.

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 526360e320)

Solutions

  1. Read the 'Open tabs' list in the error and copy an exact URL or title substring.
  2. Drop the trailing target_url argument entirely so the script defaults to the last open page.
  3. Use a shorter, stable substring of the URL (e.g. the hostname without scheme/path).
  4. Confirm you are talking to the right Chromium instance on port 9222.

Example fix

// before
node cdp-input.js click 100 200 https://app.example.com/dashboard/
// after — omit filter to use the last tab, or use a stable substring
node cdp-input.js click 100 200 app.example.com
Defensive patterns

Strategy: validation

Validate before calling

const targets = JSON.parse(await httpGet('http://127.0.0.1:9222/json'));
const pages = targets.filter((t) => t.type === 'page');
const ok = pages.some(
  (p) => p.url.includes(targetUrl) || p.title.toLowerCase().includes(targetUrl.toLowerCase())
);
if (!ok) throw new Error(`No tab matches '${targetUrl}'. Open: ${pages.map(p => p.url).join(', ')}`);

Prevention

When it happens

Trigger: Passing a 4th/5th argv filter (e.g. `node cdp-input.js click 10 20 myapp.local`) where 'myapp.local' is not a substring of any open tab's URL or title. Also triggered by a typo in the filter, a trailing slash mismatch, or when the intended tab navigated away to a different URL before the command ran.

Common situations: The target SPA changed its route so the URL substring no longer matches; the title changed dynamically; the filter used 'https://' prefix but tabs store a normalized URL; multiple Chromium instances and the script connected to the wrong one.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/a6b3cdf7825e5118. Report an issue: GitHub.