{"record":{"id":"a49ad1574e7820c8","repo":"quasarframework/quasar","slug":"failed-to-inform-portname-about-the-port-list","errorCode":null,"errorMessage":"Failed to inform \"${portName}\" about the port list.","messagePattern":"Failed to inform \"(.+?)\" about the port list\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/exports/bex/private/bex-bridge.js","lineNumber":475,"sourceCode":"  /**\n   * Should be used only by the background script\n   * @param {{ added?: string } | { removed?: string }} reason\n   */\n  #onPortChange(reason) {\n    this.portList = Object.keys(this.portMap)\n    this.#notifyPortWaiters()\n    const list = ['background', ...this.portList]\n\n    for (const portName of this.portList) {\n      this.send({\n        event: '@quasar:ports',\n        to: portName,\n        payload: {\n          portList: list.filter(name => name !== portName),\n          ...reason\n        }\n      }).catch(err => {\n        this.warn(`Failed to inform \"${portName}\" about the port list.`, err)\n      })\n    }\n  }\n\n  /**\n   * 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","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/exports/bex/private/bex-bridge.js#L457-L493","documentation":"The background side of the Quasar BEX bridge, when the set of connected ports changes (#onPortChange), notifies affected ports about the new port list. If the message to a specific port fails to deliver, the promise rejection is logged with this warning naming the port. It typically means the target content script/iframe port closed just as the list update was sent.","triggerScenarios":"A port (content script, options/popup page) disconnects or is destroyed while the background iterates the port list in #onPortChange and attempts to send it the updated list via bridge messaging; the send promise rejects (port closed, target page unloaded).","commonSituations":"User closes a tab or popup mid-handshake; page navigates away while ports are being re-broadcast; multiple frames connect/disconnect rapidly during hot reload in BEX dev mode.","solutions":["Ignore it if transient — it usually means the target port was already gone; the portList update is moot for a dead port.","Ensure content scripts properly disconnect/cleanup ports on beforeunload or pagehide.","Check that the named port's receiving side actually listens for the portList payload and doesn't throw while processing it.","Reopen/reload the affected page so it reconnects and receives the current port list."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before sending to a port, verify it is still open\nfunction isPortOpen(port: chrome.runtime.Port | undefined): boolean {\n  return port !== undefined // closed ports throw on postMessage\n}","typeGuard":"function isPortAlive(port: chrome.runtime.Port | null): port is chrome.runtime.Port {\n  return port != null && typeof port.postMessage === 'function'\n}","tryCatchPattern":"try {\n  await bridge.send({ to: portName, payload: { portList } })\n} catch (err) {\n  // target port already gone — safe to ignore or prune it from the list\n  prunePort(portName)\n}","preventionTips":["Clean up bridge connections on beforeunload/pagehide in content scripts.","Wrap all bridge sends in promise catches (as the bridge itself does).","In dev, tolerate transient port-change warnings during hot reload.","Keep the number of simultaneous BEX ports small and well-managed."],"tags":["bex","browser-extension","port","messaging"],"backgroundTag":"bex-port-list-notification-failed","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}