{"record":{"id":"5604c2e95d5cf53f","repo":"quasarframework/quasar","slug":"failed-to-query-the-tabs-to-revive-the-content-scr","errorCode":null,"errorMessage":"Failed to query the tabs to revive the content script connections.","messagePattern":"Failed to query the tabs to revive the content script connections\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/exports/bex/private/bex-bridge.js","lineNumber":499,"sourceCode":"   * Should be used only by the background script.\n   *\n   * The clients cannot be reached through ports (none are available on a\n   * fresh background script start), so one-off runtime messages are used.\n   */\n  async #revivePortClients() {\n    // reach the app (popup / devtools / options / extension pages)\n    runtime.sendMessage(reviveSignature).catch(() => {\n      // no app page is listening\n    })\n\n    if (tabs === void 0) return\n\n    let tabList\n\n    try {\n      tabList = await tabs.query({})\n    } catch (err) {\n      this.warn(\n        'Failed to query the tabs to revive the content script connections.',\n        err\n      )\n      return\n    }\n\n    // reach the content scripts\n    for (const { id } of tabList) {\n      if (id !== void 0) {\n        tabs.sendMessage(id, reviveSignature).catch(() => {\n          // no content script is listening on this tab\n        })\n      }\n    }\n  }\n\n  /**\n   * The requested port might be just about to (re)register itself (e.g.","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/exports/bex/private/bex-bridge.js#L481-L517","documentation":"The BEX bridge's internal #revivePortClients routine asks the browser tabs API (chrome.tabs.query({})) to enumerate open tabs so it can re-establish content-script connections (e.g. after a background worker restarts in MV3). When the tabs.query call rejects, the bridge logs this warning and returns, leaving content-script connections unreopened.","triggerScenarios":"Constructor-time revival runs and chrome.tabs.query rejects — typically due to missing 'tabs' permission in manifest.json, an unsupported context (no tabs API, e.g. some extension surfaces), or a transient browser API failure during service-worker shutdown/restart.","commonSituations":"MV3 service worker restart reviving ports; developer forgot the 'tabs' permission in the BEX manifest's bex section; running the bridge in a context where chrome.tabs is undefined (options page of certain builds, or non-Chromium targets); testing in a browser whose extension APIs are partially unavailable.","solutions":["Add the 'tabs' permission to the manifest section of your BEX manifest file","Check the companion `err` object logged with the warning for the underlying browser API error","Ensure the bridge is only instantiated in extension contexts where chrome.tabs exists (background/content scripts)","Restart the dev server / reload the extension if it was a transient service-worker restart race"],"exampleFix":"// before (src-bex/manifest.json)\n{\n  \"permissions\": []\n}\n// after\n{\n  \"permissions\": [\"tabs\"]\n}","handlingStrategy":"try-catch","validationCode":"// before instantiating the bridge in an extension context\nif (typeof chrome !== 'undefined' && chrome.tabs && chrome.tabs.query) {\n  // tabs API available; also ensure manifest declares \"permissions\": [\"tabs\"]\n}","typeGuard":"function hasTabsApi(api) {\n  return typeof api !== 'undefined' && typeof api.query === 'function'\n}\n// usage: hasTabsApi(globalThis.chrome?.tabs)","tryCatchPattern":"try {\n  await bridge.send('my.event', payload)\n} catch (err) {\n  if (String(err).includes('tabs')) {\n    console.warn('Tabs API unavailable: check \"tabs\" permission in BEX manifest')\n  }\n}","preventionTips":["Always declare the 'tabs' permission in src-bex/manifest.json when using the bridge's port revival","Only instantiate the bridge in contexts where chrome.tabs exists (background/content scripts)","Read the companion err object logged with this warning for the underlying API error","Test the extension after a service-worker restart (MV3) to confirm ports revive"],"tags":["bex","browser-extension","permissions","content-script"],"backgroundTag":"missing-extension-permission","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}