{"record":{"id":"c9f3289ae50cdc1a","repo":"quasarframework/quasar","slug":"received-an-unknown-message-type-packet-type","errorCode":null,"errorMessage":"Received an unknown message type: \"${packet.type}\".","messagePattern":"Received an unknown message type: \"(.+?)\"\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/exports/bex/private/bex-bridge.js","lineNumber":741,"sourceCode":"        this.#onMessage({\n          id: packet.id,\n          from: packet.from,\n          to: packet.to,\n          payload: chunk.payload,\n          type: chunk.messageType,\n          props: chunk.messageProps\n        })\n      }\n\n      return\n    }\n\n    if (packet.type === 'chunk-abort') {\n      delete this.chunkMap[packet.id]\n      return\n    }\n\n    this.warn(`Received an unknown message type: \"${packet.type}\".`)\n  }\n\n  #sendPacket(packet) {\n    this.log(\n      packet.from === this.portName\n        ? `Sending message of type \"${packet.type}\" to \"${packet.to}\".`\n        : `Forwarding message of type \"${packet.type}\" from \"${packet.from}\" to \"${packet.to}\".`,\n      packet\n    )\n\n    const port =\n      this.#type === 'background'\n        ? this.portMap[packet.to]\n        : this.portMap.background\n\n    if (!this.portList.includes(packet.to)) {\n      return Promise.reject(\n        `Tried to send message of type \"${packet.type}\" to \"${packet.to}\" but there is no such port registered`","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/exports/bex/private/bex-bridge.js#L723-L759","documentation":"The BEX bridge's #onPacket handler processes low-level packets between extension contexts (background, content scripts, UI). After checking 'chunk' and 'chunk-abort' types, any other packet.type it doesn't recognize triggers this warning. It means a packet arrived whose type is neither 'full', 'chunk' nor 'chunk-abort' — almost always a version mismatch between bridge copies or corrupted/malicious postMessage traffic.","triggerScenarios":"A packet is posted to this port whose type property is not 'full', 'chunk' or 'chunk-abort' (e.g. an external script posting raw messages on the same window/port, or two bridge versions in different contexts disagreeing on the protocol).","commonSituations":"Mixed @quasar/app-vite versions: an extension rebuilt with a newer bridge talking to a stale background/content script that wasn't reloaded; a website script or another extension injecting messages into the content-script window where the bridge listens; hand-crafted test messages with a typo'd type.","solutions":["Reload/rebuild all extension contexts (chrome://extensions -> reload) so every script runs the same bridge version","Check that no external script posts arbitrary messages on the window/port the bridge listens to; filter by event source or use a dedicated port","Log the full packet (the warning context) and confirm the 'type' field value; fix the sender's type spelling","If you own both sides, align packet.type strings with the bridge protocol ('full', 'chunk', 'chunk-abort')"],"exampleFix":"// before (sender, custom type)\nport.postMessage({ type: 'my-event', payload })\n// after: send through the bridge API so it wraps in a known packet type\nbridge.send('my-event', payload)","handlingStrategy":"validation","validationCode":"// before wiring a raw port listener, validate packets yourself\nconst KNOWN = new Set(['full', 'chunk', 'chunk-abort'])\nwindow.addEventListener('message', ev => {\n  const p = ev.data\n  if (p && typeof p.type === 'string' && KNOWN.has(p.type)) bridge.handle(p)\n  else console.warn('ignoring foreign packet', p)\n})","typeGuard":"const isBridgePacket = p =>\n  p !== null && typeof p === 'object' &&\n  ['full', 'chunk', 'chunk-abort'].includes(p.type) &&\n  typeof p.from === 'string' && typeof p.to === 'string'","tryCatchPattern":null,"preventionTips":["Keep all extension contexts built from the same app-vite version; reload the extension after rebuilds","Never post raw messages on the same window event/port the bridge consumes","Pin/filter incoming messages by event.source or port sender identity","Smoke-test all contexts (background + content + UI) after upgrading Quasar"],"tags":["bex","browser-extension","ipc","protocol-mismatch"],"backgroundTag":"unknown-message-type","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}