mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 01:01:59 +00:00
browser: fix stale-target error message for non-relay profiles
This commit is contained in:
@@ -314,7 +314,7 @@ export async function executeActAction(params: {
|
|||||||
})) as { tabs?: unknown[] }
|
})) as { tabs?: unknown[] }
|
||||||
).tabs ?? [])
|
).tabs ?? [])
|
||||||
: await browserTabs(baseUrl, { profile }).catch(() => []);
|
: await browserTabs(baseUrl, { profile }).catch(() => []);
|
||||||
// Some Chrome relay targetIds can go stale between snapshots and actions.
|
// Some user-browser targetIds can go stale between snapshots and actions.
|
||||||
// Only retry safe read-only actions, and only when exactly one tab remains attached.
|
// Only retry safe read-only actions, and only when exactly one tab remains attached.
|
||||||
if (retryRequest && canRetryChromeActWithoutTargetId(request) && tabs.length === 1) {
|
if (retryRequest && canRetryChromeActWithoutTargetId(request) && tabs.length === 1) {
|
||||||
try {
|
try {
|
||||||
@@ -334,8 +334,12 @@ export async function executeActAction(params: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tabs.length) {
|
if (!tabs.length) {
|
||||||
|
// Extension relay profiles need the toolbar icon click; Chrome MCP just needs Chrome running.
|
||||||
|
const isRelayProfile = profile === "chrome-relay" || profile === "chrome";
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"No Chrome tabs are attached via the OpenClaw Browser Relay extension. Click the toolbar icon on the tab you want to control (badge ON), then retry.",
|
isRelayProfile
|
||||||
|
? "No Chrome tabs are attached via the OpenClaw Browser Relay extension. Click the toolbar icon on the tab you want to control (badge ON), then retry."
|
||||||
|
: `No Chrome tabs found for profile="${profile}". Make sure Chrome (v146+) is running and has open tabs, then retry.`,
|
||||||
{ cause: err },
|
{ cause: err },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user