{"record":{"id":"990eb884a23261de","repo":"stablyai/orca","slug":"browser-no-tab-990eb8","errorCode":"browser_no_tab","errorMessage":"No browser tab is open. Use the Orca UI to open a browser tab first.","messagePattern":"No browser tab is open\\. Use the Orca UI to open a browser tab first\\.","errorType":"exception","errorClass":"BrowserError","httpStatus":null,"severity":"error","filePath":"src/main/browser/cdp-bridge.ts","lineNumber":1035,"sourceCode":"  onTabChanged(webContentsId: number): void {\n    this.activeWebContentsId = webContentsId\n  }\n\n  // ── Private helpers ──\n\n  private getActiveGuest(): Electron.WebContents {\n    if (this.activeWebContentsId !== null) {\n      const guest = webContents.fromId(this.activeWebContentsId)\n      if (guest && !guest.isDestroyed()) {\n        return guest\n      }\n      // Why: webContentsId goes stale after a process swap; fall through to auto-select since the tab may have a new id.\n      this.activeWebContentsId = null\n    }\n\n    const tabs = [...this.getRegisteredTabs()]\n    if (tabs.length === 0) {\n      throw new BrowserError(\n        'browser_no_tab',\n        'No browser tab is open. Use the Orca UI to open a browser tab first.'\n      )\n    }\n    if (tabs.length === 1) {\n      this.activeWebContentsId = tabs[0][1]\n    } else {\n      throw new BrowserError(\n        'browser_no_tab',\n        \"Multiple browser tabs are open. Run 'orca tab list' and 'orca tab switch --index <n>' to select one.\"\n      )\n    }\n\n    const guest = webContents.fromId(this.activeWebContentsId!)\n    if (!guest || guest.isDestroyed()) {\n      this.activeWebContentsId = null\n      throw new BrowserError(\n        'browser_debugger_detached',","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/browser/cdp-bridge.ts#L1017-L1053","documentation":"getActiveGuest() is the private resolver called by every CDP command to find which WebContents to operate on. If no tab has been explicitly selected (activeWebContentsId is null) and the registry is empty, there is no tab to target. The message directs the user to open a browser tab via the Orca UI before issuing automation commands. Every public method (click, fill, screenshot, etc.) hits this path.","triggerScenarios":"Calling any browser-automation command before any browser tab has been opened in the current workspace; all tabs were closed and the registry is now empty.","commonSituations":"Agent attempts browser actions in a fresh workspace with no tab open; all tabs were closed during a session; remote Orca server with no browser tab created yet.","solutions":["Open a browser tab in the Orca UI or via the tab-creation API before issuing commands.","Check bridge.tabList().tabs.length === 0 before issuing commands and create a tab if needed.","Guard agent workflows with a 'no tab open' check at the top."],"exampleFix":"// before\nawait bridge.click('ref1')\n\n// after\nif (bridge.tabList().tabs.length === 0) {\n  await bridge.goto('https://example.com') // or createTab\n}\nawait bridge.click('ref1')","handlingStrategy":"validation","validationCode":"if (bridge.tabList().tabs.length === 0) {\n  throw new Error('No browser tab is open. Open a tab first.')\n}\nawait bridge.click(ref)","typeGuard":null,"tryCatchPattern":"try {\n  await bridge.click(ref)\n} catch (e) {\n  if (e instanceof BrowserError && e.code === 'browser_no_tab' && /No browser tab/.test(e.message)) {\n    // create or open a tab, then retry\n  }\n  throw e\n}","preventionTips":["Check tabList().tabs.length > 0 before issuing any browser command.","In agent workflows, open a tab as the first step before any automation.","Handle browser_no_tab as a recoverable error by prompting the user to open a tab."],"tags":["tabs","browser","precondition","no-tab"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}