{"record":{"id":"9b142134a57e9e7a","repo":"openclaw/openclaw","slug":"chrome-tab-not-found-stale-targetid-run-action","errorCode":null,"errorMessage":"Chrome tab not found (stale targetId?). Run action=tabs profile=\"${profile}\" and use one of the returned targetIds.","messagePattern":"Chrome tab not found \\(stale targetId\\?\\)\\. Run action=tabs profile=\"(.+?)\" and use one of the returned targetIds\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/browser/src/browser-tool.actions.ts","lineNumber":528,"sourceCode":"              body: retryRequest,\n              timeoutMs: resolveActProxyTimeoutMs(retryRequest),\n            })\n          : await browserToolActionDeps.browserAct(baseUrl, retryRequest, {\n              profile,\n            });\n        return await finishActResult(\n          retryResult,\n          readStringValue((retryResult as { targetId?: unknown }).targetId) ??\n            readStringValue(retryRequest.targetId),\n        );\n      }\n      if (!tabs.length) {\n        throw new Error(\n          `No browser tabs found for profile=\"${profile}\". Make sure the configured Chromium-based browser (v144+) is running and has open tabs, then retry.`,\n          { cause: err },\n        );\n      }\n      throw new Error(\n        `Chrome tab not found (stale targetId?). Run action=tabs profile=\"${profile}\" and use one of the returned targetIds.`,\n        { cause: err },\n      );\n    }\n    throw err;\n  }\n}\n\nfunction formatActToolResult(\n  result: unknown,\n  aborted: BrowserBatchAbort | null,\n): AgentToolResult<unknown> {\n  const formatted = formatBrowserExternalToolResult({ kind: \"act\", payload: result });\n  if (!aborted) {\n    return formatted;\n  }\n  // Navigation aborts get fresh page state (or an unavailable hint) appended by\n  // finishActResult, so only the closed case tells the model to snapshot manually.","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/browser/src/browser-tool.actions.ts#L510-L546","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (stale targetId)\nawait browser({ action: 'act', targetId: 'OLD_TARGET', profile: 'default', request: { kind: 'click', ref: 'btn' } });\n\n// after\nconst tabs = await browser({ action: 'tabs', profile: 'default' });\nconst freshId = tabs[0].targetId;\nawait browser({ action: 'snapshot', targetId: freshId, profile: 'default' }); // refresh refs\nawait browser({ action: 'act', targetId: freshId, profile: 'default', request: { kind: 'click', ref: 'btn' } });","handlingStrategy":"retry","validationCode":"// Refresh targetId before retrying after a stale-target error\nconst tabs = await browser({ action: 'tabs', profile: 'default' });\nif (tabs.length > 0) {\n  const freshTargetId = tabs[0].targetId;\n  await browser({ action: 'snapshot', targetId: freshTargetId, profile: 'default' });\n}","typeGuard":null,"tryCatchPattern":"try {\n  await browser({ action: 'act', targetId, profile, request });\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Chrome tab not found')) {\n    const tabs = await browser({ action: 'tabs', profile });\n    const freshId = tabs[0]?.targetId;\n    if (freshId) {\n      await browser({ action: 'snapshot', targetId: freshId, profile }); // refresh refs\n      await browser({ action: 'act', targetId: freshId, profile, request });\n    }\n  }\n}","preventionTips":["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."],"tags":["browser","chrome","tabs","stale-target","runtime"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}