{"record":{"id":"f93a092ddd761113","repo":"sgl-project/sglang","slug":"delta-payload-size-mismatch-expected-expectedsi-f93a09","errorCode":null,"errorMessage":"delta payload size mismatch: expected ${expectedSize}, got ${restored.length}","messagePattern":"delta payload size mismatch: expected (.+?), got (.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/apps/realtime_webui/decoder_worker.js","lineNumber":27,"sourceCode":"function reset() {\n  lastFrame = null;\n}\n\nasync function gunzipBytes(payload) {\n  if (typeof DecompressionStream === \"undefined\") {\n    throw new Error(\"This browser does not support gzip stream decoding\");\n  }\n  const stream = new Blob([payload]).stream().pipeThrough(new DecompressionStream(\"gzip\"));\n  return new Uint8Array(await new Response(stream).arrayBuffer());\n}\n\nasync function restoreDeltaGzipFrames(header, payload) {\n  const frameBytes = Number(header.bytes_per_frame);\n  const count = Number(header.num_frames);\n  const expectedSize = frameBytes * count;\n  const restored = await gunzipBytes(payload);\n  if (restored.length !== expectedSize) {\n    throw new Error(`delta payload size mismatch: expected ${expectedSize}, got ${restored.length}`);\n  }\n\n  let previous = header.delta_reference === \"previous-frame\" ? lastFrame : null;\n  if (header.delta_reference === \"previous-frame\") {\n    if (!previous) throw new Error(\"Missing previous frame for delta payload\");\n    if (previous.byteLength !== frameBytes) {\n      throw new Error(\"Previous frame size does not match current delta payload\");\n    }\n  }\n\n  for (let f = 0; f < count; f++) {\n    const offset = f * frameBytes;\n    if (previous) {\n      for (let i = 0; i < frameBytes; i++) restored[offset + i] ^= previous[i];\n    }\n    previous = restored.slice(offset, offset + frameBytes);\n  }\n  lastFrame = previous;","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/realtime_webui/decoder_worker.js#L9-L45","documentation":"The CustomAllreduceImpl dispatch only instantiates cross_device_reduce kernels for world sizes 2, 4, 6, 8 via REDUCE_CASE macros. Any other world_size_ at allreduce time hits the default branch.","triggerScenarios":"Calling the allreduce kernel with world_size_ not in {2,4,6,8}, i.e. the object was constructed (or the world changed) to an unsupported size.","commonSituations":"Odd GPU counts (3,5,7) reaching this path despite init checks elsewhere; world_size 1 erroneously using custom allreduce; version drift where init validation was bypassed.","solutions":["Use an even TP size in {2,4,6,8}","Disable custom allreduce (fall back to RCCL) for unsupported sizes","Guard at startup: assert world_size in (2,4,6,8) before enabling custom kernels"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert custom_ar.world_size_ in (2,4,6,8), 'unsupported TP for custom allreduce'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert supported TP at startup","Fall back to RCCL for unsupported sizes"],"tags":["rocm","allreduce","tensor-parallel"],"backgroundTag":"world-size-unsupported","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}