{"record":{"id":"e68de6125f48d9f3","repo":"garrytan/gstack","slug":"cannot-dispatch-tab-input-tabid-not-found-cau","errorCode":null,"errorMessage":"Cannot dispatch: tab ${input.tabId} not found.\nCause: tab was closed between command queue and dispatch.\nAction: $B tabs to list current tabs.","messagePattern":"Cannot dispatch: tab (.+?) not found\\.\nCause: tab was closed between command queue and dispatch\\.\nAction: \\$B tabs to list current tabs\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/cdp-bridge.ts","lineNumber":154,"sourceCode":"      `DENIED: ${qualified} is not on the CDP allowlist.\\n` +\n        `Cause: deny-default posture; method has not been audited and added to cdp-allowlist.ts.\\n` +\n        `Action: if this method is genuinely needed, open a PR adding it to CDP_ALLOWLIST with a one-line justification + scope (tab|browser) + output (trusted|untrusted).`\n    );\n  }\n  // Acquire the right tier of lock.\n  const acquireStart = Date.now();\n  const release =\n    entry.scope === 'browser'\n      ? await input.bm.acquireGlobalCdpLock(CDP_ACQUIRE_TIMEOUT_MS)\n      : await input.bm.acquireTabLock(input.tabId, CDP_ACQUIRE_TIMEOUT_MS);\n  const acquireMs = Date.now() - acquireStart;\n  logTelemetry({ event: 'cdp_method_lock_acquire_ms', domain: input.domain, method: input.method, ms: acquireMs });\n  logTelemetry({ event: 'cdp_method_called', domain: input.domain, method: input.method, allowed: true, scope: entry.scope });\n\n  try {\n    const page = input.bm.getPageForTab(input.tabId);\n    if (!page) {\n      throw new Error(\n        `Cannot dispatch: tab ${input.tabId} not found.\\n` +\n          'Cause: tab was closed between command queue and dispatch.\\n' +\n          'Action: $B tabs to list current tabs.'\n      );\n    }\n    let session;\n    try {\n      session = await getCdpSession(page);\n    } catch (e: any) {\n      throw new Error(\n        `CDPSessionInvalidated: ${e.message}\\n` +\n          'Cause: Playwright context was recreated (e.g., viewport scale change) and the prior CDP session is stale.\\n' +\n          'Action: retry the command; the bridge will create a fresh session.'\n      );\n    }\n    // Race the call against a hard timeout.\n    const callPromise = session.send(qualified, input.params);\n    const timeoutPromise = new Promise((_, reject) =>","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/cdp-bridge.ts#L136-L172","documentation":"Error \"Cannot dispatch: tab ${input.tabId} not found.\nCause: tab was closed between command queue and dispatch.\nAction: $B tabs to list current tabs.\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/cdp-bridge.ts:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}