openclaw/openclaw · error · Error
Chrome tab not found (stale targetId?). Run action=tabs prof
Error message
Chrome tab not found (stale targetId?). Run action=tabs profile="${profile}" and use one of the returned targetIds. What it means
Thrown during act-action execution when a Chrome stale-target error is detected, tabs are re-listed, and at least one tab exists but none matched for an automatic single-tab retry (i.e. there are 0 or 2+ tabs, or the request type is not retry-safe). The targetId used in the original request is no longer valid and the model must explicitly select a fresh one.
Source
Thrown at extensions/browser/src/browser-tool.actions.ts:528
body: retryRequest,
timeoutMs: resolveActProxyTimeoutMs(retryRequest),
})
: await browserToolActionDeps.browserAct(baseUrl, retryRequest, {
profile,
});
return await finishActResult(
retryResult,
readStringValue((retryResult as { targetId?: unknown }).targetId) ??
readStringValue(retryRequest.targetId),
);
}
if (!tabs.length) {
throw new Error(
`No browser tabs found for profile="${profile}". Make sure the configured Chromium-based browser (v144+) is running and has open tabs, then retry.`,
{ cause: err },
);
}
throw new Error(
`Chrome tab not found (stale targetId?). Run action=tabs profile="${profile}" and use one of the returned targetIds.`,
{ cause: err },
);
}
throw err;
}
}
function formatActToolResult(
result: unknown,
aborted: BrowserBatchAbort | null,
): AgentToolResult<unknown> {
const formatted = formatBrowserExternalToolResult({ kind: "act", payload: result });
if (!aborted) {
return formatted;
}
// Navigation aborts get fresh page state (or an unavailable hint) appended by
// finishActResult, so only the closed case tells the model to snapshot manually.View on GitHub (pinned to 01804a7531)
Solutions
- Run action=tabs profile="<name>" to get the current list of valid targetIds.
- Take a fresh snapshot against the new targetId to regenerate refs before re-issuing ref-scoped actions.
- Use the returned targetId in subsequent act requests.
- If the tab was closed, open a new one (action=open) and snapshot it.
Example fix
// before (stale targetId)
await browser({ action: 'act', targetId: 'OLD_TARGET', profile: 'default', request: { kind: 'click', ref: 'btn' } });
// after
const tabs = await browser({ action: 'tabs', profile: 'default' });
const freshId = tabs[0].targetId;
await browser({ action: 'snapshot', targetId: freshId, profile: 'default' }); // refresh refs
await browser({ action: 'act', targetId: freshId, profile: 'default', request: { kind: 'click', ref: 'btn' } }); Defensive patterns
Strategy: retry
Validate before calling
// Refresh targetId before retrying after a stale-target error
const tabs = await browser({ action: 'tabs', profile: 'default' });
if (tabs.length > 0) {
const freshTargetId = tabs[0].targetId;
await browser({ action: 'snapshot', targetId: freshTargetId, profile: 'default' });
} Try / catch
try {
await browser({ action: 'act', targetId, profile, request });
} catch (err) {
if (err instanceof Error && err.message.includes('Chrome tab not found')) {
const tabs = await browser({ action: 'tabs', profile });
const freshId = tabs[0]?.targetId;
if (freshId) {
await browser({ action: 'snapshot', targetId: freshId, profile }); // refresh refs
await browser({ action: 'act', targetId: freshId, profile, request });
}
}
} Prevention
- After navigation or long waits, re-list tabs (action=tabs) before issuing ref-scoped actions.
- Take a fresh snapshot after target changes to regenerate refs.
- Avoid caching targetIds across navigations that may close or replace tabs.
When it happens
Trigger: executeActAction detects isChromeStaleTargetError, lists tabs, but either tabs.length > 1 (ambiguous which tab to retry against) or tabs.length === 1 but the request is not target-independent (canRetryChromeActAfterSoleTargetRefresh is false). The original error is attached as cause.
Common situations: The bound tab was closed or navigated to a new target; multiple tabs are open so auto-retry is ambiguous; ref-scoped or scripted actions can't safely retry because refs are stale after a target change.
Related errors
- No browser tabs found for profile="${profile}". Make sure th
- tab ${tabId} is not available to OpenClaw
- tab ${tabId} closed during attach
- Managed Chrome for profile "${profile.name}" exited before a
- Managed Chrome for profile "${profile.name}" did not own its
AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12).
Data as JSON: /api/errors/9b142134a57e9e7a.
Report an issue: GitHub.