fix(browser): clarify stale targetId errors (tab not found)
This commit is contained in:
parent
6b1f485ce8
commit
544c47e0d2
@ -15,6 +15,21 @@ function enhanceBrowserFetchError(url: string, err: unknown, timeoutMs: number):
|
||||
: `Start (or restart) the OpenClaw gateway (OpenClaw.app menubar, or \`${formatCliCommand("openclaw gateway")}\`) and try again.`;
|
||||
const msg = String(err);
|
||||
const msgLower = msg.toLowerCase();
|
||||
|
||||
// The control service is often healthy, but the targetId/tab becomes stale (e.g., after a
|
||||
// profile restart or transient CDP disconnect). Surface that explicitly to avoid misleading
|
||||
// users with a generic "can't reach the control service" error.
|
||||
const looksLikeMissingTarget =
|
||||
msgLower.includes("tab not found") ||
|
||||
msgLower.includes("target not found") ||
|
||||
msgLower.includes("no such target") ||
|
||||
msgLower.includes("target closed");
|
||||
if (looksLikeMissingTarget) {
|
||||
return new Error(
|
||||
`OpenClaw browser tab/target was not found (stale targetId). Re-open the page to get a new targetId and retry. (${msg})`,
|
||||
);
|
||||
}
|
||||
|
||||
const looksLikeTimeout =
|
||||
msgLower.includes("timed out") ||
|
||||
msgLower.includes("timeout") ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user