stablyai/orca · warning · BrowserError
browser_tab_changed
browser_tab_changed
Error message
Browser page ${target.browserPageId} changed while evaluating; retry the command What it means
Thrown by evaluate() after a successful Runtime.evaluate when re-resolving the command target shows the browserPageId now maps to a different webContentsId than when the command started — the tab navigated to a new page or was replaced during eval. The message explicitly instructs retry. This guards against returning a result computed in a now-stale page context.
Source
Thrown at src/main/browser/agent-browser-bridge.ts:1583
releaseDebugger = acquireElectronDebugger(wc).release
const { result, exceptionDetails } = (await wc.debugger.sendCommand('Runtime.evaluate', {
expression,
returnByValue: true,
awaitPromise: true
})) as {
result: { value?: unknown; description?: string }
exceptionDetails?: { text: string; exception?: { description?: string } }
}
if (exceptionDetails) {
throw new BrowserError(
'browser_eval_error',
exceptionDetails.exception?.description ?? exceptionDetails.text
)
}
const currentTarget = this.resolveCommandTarget(worktreeId, target.browserPageId)
if (currentTarget.webContentsId !== target.webContentsId) {
throw new BrowserError(
'browser_tab_changed',
`Browser page ${target.browserPageId} changed while evaluating; retry the command`
)
}
return {
result:
result.value !== undefined
? typeof result.value === 'object' && result.value !== null
? JSON.stringify(result.value)
: String(result.value)
: (result.description ?? ''),
origin: wc.getURL()
}
} catch (error) {
if (error instanceof BrowserError) {
throw error
}
if (!this.getWebContents(target.webContentsId)) {View on GitHub (pinned to 1136503c6a)
Solutions
- Retry the evaluate command — the message explicitly says 'retry the command' and the new target will be current.
- If the page is prone to navigation, wait for a stable URL/load event before issuing the eval.
- For SPA flows, use a wait(url/load) before evaluate to ensure the page has settled.
Defensive patterns
Strategy: retry
Type guard
function isTabChangedError(e: unknown): boolean {
return e instanceof BrowserError && e.code === 'browser_tab_changed'
} Try / catch
for (let attempt = 0; attempt < 2; attempt++) {
try {
return await bridge.evaluate(expression, worktreeId, browserPageId)
} catch (e) {
if (e instanceof BrowserError && e.code === 'browser_tab_changed' && attempt === 0) continue
throw e
}
} Prevention
- Call wait({ load: 'load' }) or wait({ url }) before evaluate on navigation-prone pages
- Avoid issuing click/navigate and evaluate back-to-back on the same tab without a settle
- Track navigation state and only evaluate when the page is stable
When it happens
Trigger: evaluate() captures target.webContentsId, sends Runtime.evaluate (which awaits the promise), and during that await the page navigates (SPAroute change, redirect, or full navigation) causing resolveCommandTarget to return a different webContentsId for the same browserPageId. SPA navigations that swap the WebContents, or client-side redirects, trigger this.
Common situations: Evaluating an expression on a page that auto-redirects (login flows, meta-refresh); SPA route transitions mid-eval; the agent issued a click that triggered navigation while an eval was in flight; tab replacement (e.g. prerender activation).
Related errors
- invalid_argument
- Translation request failed with status ${response.status}
- Electron trial exhausted launcher attempts
- Waiting for desktop...
- ${response.error.message}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/71d148749eecc0af.
Report an issue: GitHub.