Mintplex-Labs/anything-llm · error · Error

No browser pages open.

Error message

No browser pages open.

What it means

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.

Source

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

  const versionRaw = await httpGet("http://127.0.0.1:9222/json/version");
  const version = JSON.parse(versionRaw);
  const browserWsUrl = version.webSocketDebuggerUrl;
  if (!browserWsUrl) throw new Error("No webSocketDebuggerUrl — is Chromium running?");

  const ws = await new Promise((resolve, reject) => {
    const socket = new WebSocket(browserWsUrl);
    const t = setTimeout(() => reject(new Error("WS connect timeout")), 5000);
    socket.on("open", () => { clearTimeout(t); resolve(socket); });
    socket.on("error", (err) => { clearTimeout(t); reject(err); });
  });

  try {
    // Find target page
    const { targetInfos } = await cdpSend(ws, "Target.getTargets");
    const pages = targetInfos.filter(
      (t) => t.type === "page" && !t.url.startsWith("chrome://") && !t.url.startsWith("devtools://")
    );
    if (pages.length === 0) throw new Error("No browser pages open.");

    // 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");

View on GitHub (pinned to 526360e320)

Solutions

  1. Open a real page in the target Chromium first (navigate to any http/https URL) before invoking cdp-input.js.
  2. Launch Chromium with an initial URL: `chromium --remote-debugging-port=9222 https://example.com`.
  3. Verify with `curl http://127.0.0.1:9222/json` that at least one entry has type 'page' and a non-internal URL.
  4. If running headless, pass the page URL at startup since you cannot open tabs interactively.

Example fix

// before
chromium --headless --remote-debugging-port=9222
// after
chromium --headless --remote-debugging-port=9222 https://your-app.test
Defensive patterns

Strategy: validation

Validate before calling

const http = require('http');
httpGet('http://127.0.0.1:9222/json').then((body) => {
  const targets = JSON.parse(body);
  const realPages = targets.filter(
    (t) => t.type === 'page' && !t.url.startsWith('chrome://') && !t.url.startsWith('devtools://')
  );
  if (realPages.length === 0) throw new Error('Open a real page in Chromium before running cdp-input');
});

Prevention

When it happens

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

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

Related errors


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