openclaw/openclaw · error

No pages available in the connected browser.

Error message

No pages available in the connected browser.

What it means

A plain Error thrown when getAllPages(browser) returns an empty array immediately after a successful connectBrowser. The browser connected and reported zero open pages across all contexts. There is no SSRF angle here — the page list is empty before partitionAccessiblePages runs.

Source

Thrown at extensions/browser/src/browser/pw-session-connection.ts:606

      targetInfoReads.delete(page);
    }
  };
  void pending.then(evict, evict);
  return pending;
}

async function getPageForTargetIdOnce(opts: {
  cdpUrl: string;
  targetId?: string;
  ssrfPolicy?: SsrFPolicy;
}): Promise<Page> {
  if (opts.targetId && isBlockedTarget(opts.cdpUrl, opts.targetId)) {
    throw new BlockedBrowserTargetError();
  }
  const { browser } = await connectBrowser(opts.cdpUrl, opts.ssrfPolicy);
  const pages = await getAllPages(browser);
  if (!pages.length) {
    throw new Error("No pages available in the connected browser.");
  }

  const { accessible, blockedCount } = await partitionAccessiblePages({
    cdpUrl: opts.cdpUrl,
    pages,
  });
  if (!accessible.length) {
    if (blockedCount > 0) {
      throw new BlockedBrowserTargetError();
    }
    throw new Error("No pages available in the connected browser.");
  }
  const first = expectDefined(accessible.at(0), "non-empty accessible browser pages");
  if (!opts.targetId) {
    bindRoleRefsTarget(first.page, opts.cdpUrl, first.targetId);
    return first.page;
  }
  const found = accessible.find((entry) => entry.targetId === opts.targetId);

View on GitHub (pinned to 01804a7531)

Solutions

  1. Open a tab first (via the CDP /json/new endpoint or the createPage action), then call getPageForTargetId.
  2. Verify the browser instance has at least one page: curl http://host:PORT/json/list and confirm non-empty.
  3. If launching Chrome yourself, ensure an initial page is created (do not pass --no-first-window or equivalent).
  4. Retry once — initial page creation can lag the connect by a few hundred ms.
Defensive patterns

Strategy: fallback

Validate before calling

async function ensurePageExists(cdpUrl: string) {
  const { browser } = await connectBrowser(cdpUrl);
  if ((await getAllPages(browser)).length === 0) {
    // open a tab via /json/new or a createPage action
  }
}

Try / catch

try { return await getPageForTargetId({ cdpUrl }); }
catch (e) {
  if (e instanceof Error && /No pages available/.test(e.message)) {
    await openNewTab(cdpUrl);
    return await getPageForTargetId({ cdpUrl });
  }
  throw e;
}

Prevention

When it happens

Trigger: Connecting to a Chrome instance that has no open tabs (every tab was closed, or the browser was launched headless with no initial page), or a CDP endpoint that exposes the browser but no page targets. The check `if (!pages.length)` fires before accessible-page partitioning.

Common situations: Remote Chrome started with --headless and no about:blank; all tabs were closed by a previous session; a 'browser' CDP endpoint that is actually a service worker / extension context; connecting right after browser launch before the initial page is created.

Related errors


AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12). Data as JSON: /api/errors/ea9185be765bee2a. Report an issue: GitHub.