{"record":{"id":"64ebaf8f83db3021","repo":"quasarframework/quasar","slug":"received-an-out-of-order-chunk","errorCode":null,"errorMessage":"Received an out of order chunk.","messagePattern":"Received an out of order chunk\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/exports/bex/private/bex-bridge.js","lineNumber":710,"sourceCode":"      if (chunk === void 0) {\n        if (packet.chunkIndex !== void 0) {\n          this.warn('Received an unregistered chunk.', packet)\n          return\n        }\n\n        this.chunkMap[packet.id] = {\n          portName: packet.from,\n          number: packet.chunksNumber,\n          messageType: packet.messageType,\n          messageProps: packet.messageProps,\n          payload: []\n        }\n        return\n      }\n\n      // if we received an unexpected chunk\n      if (packet.chunkIndex !== chunk.payload.length) {\n        this.warn('Received an out of order chunk.', packet)\n\n        // free up resources\n        delete this.chunkMap[packet.id]\n        return\n      }\n\n      chunk.payload.push(packet.payload)\n\n      // if we received all chunks...\n      if (packet.chunkIndex === chunk.number - 1) {\n        delete this.chunkMap[packet.id]\n\n        this.#onMessage({\n          id: packet.id,\n          from: packet.from,\n          to: packet.to,\n          payload: chunk.payload,\n          type: chunk.messageType,","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/exports/bex/private/bex-bridge.js#L692-L728","documentation":"A chunk arrived whose chunkIndex does not match the next expected index of the in-progress reassembly buffer. The bridge warns, deletes the partial chunkMap entry, and aborts the whole transfer rather than delivering a corrupt message.","triggerScenarios":"Packet reordering or loss between extension contexts (e.g. messages crossing ports while a previous transfer is still streaming); two concurrent sends interleaving chunk packets with the same id; a missed packet causing a permanent gap.","commonSituations":"Sending multiple large payloads rapidly in parallel over the same port; background service worker throttling delaying some packets; extremely large messages exceeding reliable transfer size.","solutions":["Serialize large sends (await completion of one chunked message before starting the next).","Retry the transfer from the sender when this warning appears — the message is dropped.","Split payloads into smaller messages or reduce per-message size below chunking thresholds.","Keep the receiving end alive (avoid long async work between chunk arrivals)."],"exampleFix":"// before\nbridge.send('a', bigA) // chunked\nbridge.send('b', bigB) // chunked concurrently -> interleaved\n// after\nasync function sendInOrder() {\n  await bridge.send('a', bigA)\n  await bridge.send('b', bigB)\n}","handlingStrategy":"retry","validationCode":"// serialize chunked sends to avoid interleaving\nlet sending = Promise.resolve()\nfunction sendOrdered(event, payload) {\n  sending = sending.then(() => bridge.send(event, payload))\n  return sending\n}","typeGuard":null,"tryCatchPattern":"try {\n  await bridge.send('event', largePayload)\n} catch {\n  // out-of-order chunk aborts the transfer; retry once\n  await bridge.send('event', largePayload)\n}","preventionTips":["Queue large sends so chunk streams never interleave.","Keep receiving contexts alive (no long blocking work between chunks).","Retry failed transfers — the receiving side drops partial data.","Split data into several smaller messages instead of one huge payload."],"tags":["bex","extension","chunking","out-of-order"],"backgroundTag":"chunk-transfer-out-of-sync","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}