garrytan/gstack · error · Error
CDPSessionInvalidated: ${e.message} Cause: Playwright contex
Error message
CDPSessionInvalidated: ${e.message}
Cause: Playwright context was recreated (e.g., viewport scale change) and the prior CDP session is stale.
Action: retry the command; the bridge will create a fresh session. What it means
Error "CDPSessionInvalidated: ${e.message} Cause: Playwright context was recreated (e.g., viewport scale change) and the prior CDP session is stale. Action: retry the command; the bridge will create a fresh session." thrown in garrytan/gstack.
Source
Thrown at browse/src/cdp-bridge.ts:164
: await input.bm.acquireTabLock(input.tabId, CDP_ACQUIRE_TIMEOUT_MS);
const acquireMs = Date.now() - acquireStart;
logTelemetry({ event: 'cdp_method_lock_acquire_ms', domain: input.domain, method: input.method, ms: acquireMs });
logTelemetry({ event: 'cdp_method_called', domain: input.domain, method: input.method, allowed: true, scope: entry.scope });
try {
const page = input.bm.getPageForTab(input.tabId);
if (!page) {
throw new Error(
`Cannot dispatch: tab ${input.tabId} not found.\n` +
'Cause: tab was closed between command queue and dispatch.\n' +
'Action: $B tabs to list current tabs.'
);
}
let session;
try {
session = await getCdpSession(page);
} catch (e: any) {
throw new Error(
`CDPSessionInvalidated: ${e.message}\n` +
'Cause: Playwright context was recreated (e.g., viewport scale change) and the prior CDP session is stale.\n' +
'Action: retry the command; the bridge will create a fresh session.'
);
}
// Race the call against a hard timeout.
const callPromise = session.send(qualified, input.params);
const timeoutPromise = new Promise((_, reject) =>
setTimeout(() => reject(new Error(`CDPBridgeTimeout: ${qualified} did not return within ${CDP_TIMEOUT_MS}ms`)), CDP_TIMEOUT_MS),
);
const raw = await Promise.race([callPromise, timeoutPromise]);
return { raw, entry };
} finally {
release();
}
}
View on GitHub (pinned to 94993f7401)
When it happens
Trigger: Thrown at browse/src/cdp-bridge.ts:164 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12).
Data as JSON: /api/errors/7ec5de0ff684bb4e.
Report an issue: GitHub.