jackwener/OpenCLI · error
This browser session does not support creating tabs
Error message
This browser session does not support creating tabs
What it means
The `browser tab new` subcommand requires the page to support creating tabs via an optional page.newTab capability. Some session kinds (e.g. connected/attached contexts) do not implement it, so the CLI throws rather than failing mid-operation. It is a capability guard, not a user-argument error.
Source
Thrown at src/cli.ts:1200
}));
const browserTab = browser
.command('tab')
.description('Tab management — list, create, and close tabs in the browser session');
browserTab.command('list')
.description('List tabs in the browser session with target IDs')
.action(browserAction(async (page) => {
const tabs = await page.tabs();
console.log(JSON.stringify(tabs, null, 2));
}));
browserTab.command('new')
.argument('[url]', 'Optional URL to open in the new tab')
.description('Create a new tab and print its target ID')
.action(browserAction(async (page, url?: string) => {
if (!page.newTab) {
throw new Error('This browser session does not support creating tabs');
}
const createdPage = await page.newTab(url);
console.log(JSON.stringify({
page: createdPage,
url: url ?? null,
}, null, 2));
}));
addBrowserTabOption(browserTab.command('select')
.argument('[targetId]', 'Target tab/page identity returned by "browser open", "browser tab new", or "browser tab list"')
.description('Select a tab by target ID and make it the default browser tab'))
.action(browserAction(async (page, targetId?: string, opts?: { tab?: string } | Command) => {
const resolvedTarget = resolveBrowserTabTarget(targetId, opts);
if (!resolvedTarget) {
throw new Error('Target tab required. Pass it as an argument or --tab <targetId>.');
}
await page.selectTab(resolvedTarget);
saveBrowserTargetState(resolvedTarget, getPageScope(page));View on GitHub (pinned to 49907e53dc)
Solutions
- Use a session type that supports tab creation (launch/own the browser via the library)
- Check whether the underlying browser context allows opening new pages (popup blocking, CDP permissions)
- Update the browser adapter/driver to a version implementing newTab
- Work around by opening a new page in the browser manually and selecting it via `browser tab select <targetId>`
Example fix
// before opencli browser attached-session tab new https://example.com // throws // after opencli browser launched-session tab new https://example.com
Defensive patterns
Strategy: try-catch
Validate before calling
if (typeof (page as { newTab?: unknown }).newTab !== 'function') {
throw new Error('This session does not support tab creation; use a launched browser session.');
} Type guard
function supportsNewTab(page: IPage): page is IPage & { newTab: (url?: string) => Promise<IPage> } {
return typeof (page as { newTab?: unknown }).newTab === 'function';
} Try / catch
try {
await run(['opencli', 'browser', session, 'tab', 'new', url]);
} catch (e) {
if (String((e as Error).message).includes('does not support creating tabs')) {
console.error(`Session '${session}' cannot create tabs. Launch a session owned by the CLI instead.`);
return;
}
throw e;
} Prevention
- Check session/adapter capabilities before scripting tab operations against it
- Prefer launched (CLI-owned) browser sessions when tab management is needed
- Keep browser adapters updated so optional capabilities are implemented
- Document which session kinds support newTab in team tooling
When it happens
Trigger: Running `opencli browser <session> tab new [url]` against a session whose page lacks a newTab implementation (page.newTab is undefined).
Common situations: Sessions attached to an externally managed browser that disallows tab creation; restricted/remote debugging contexts; older browser adapters without the capability.
Related errors
- This browser session does not support closing tabs
- browser hover is not supported by this browser backend
- browser focus is not supported by this browser backend
- browser dblclick is not supported by this browser backend
- browser ${checked ? 'check' : 'uncheck'} is not supported by
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/60e990d8d1d02ed5.
Report an issue: GitHub.