{"record":{"id":"04e80c407bd60f25","repo":"sgl-project/sglang","slug":"this-browser-does-not-support-gzip-stream-decoding","errorCode":null,"errorMessage":"This browser does not support gzip stream decoding","messagePattern":"This browser does not support gzip stream decoding","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/realtime_webui/app.js","lineNumber":1063,"sourceCode":"  const count = Number(header.num_frames);\n  const frameBytes = Number(header.bytes_per_frame);\n  const src = payload instanceof Uint8Array ? payload : new Uint8Array(payload);\n  const items = [];\n  for (let f = 0; f < count; f++) {\n    const offset = f * frameBytes;\n    const imageBytes = new Uint8ClampedArray(\n      src.buffer,\n      src.byteOffset + offset,\n      frameBytes,\n    );\n    items.push({ image: new ImageData(imageBytes, width, height), chunk: header.chunk_index });\n  }\n  return items;\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 restoreDeltaGzipRawRgb(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  let previous = header.delta_reference === \"previous-frame\" ? lastRawRgbFrame : null;\n  if (header.delta_reference === \"previous-frame\" && !previous) {\n    throw new Error(\"Missing previous frame for delta payload\");\n  }\n  for (let f = 0; f < count; f++) {","sourceCodeStart":1045,"sourceCodeEnd":1081,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/realtime_webui/app.js#L1045-L1081","documentation":"Thrown by ngram_corpus Param::parse after the range parses: the numeric bounds must satisfy L <= R and R <= 128. Violating either (inverted range or upper bound beyond the hard cap of 128 positions) raises this error.","triggerScenarios":"resetBatchReturnTokenNum with a segment like '8-2|3' (L > R) or '4-200|3' (R > 128). Note atoi is used, so non-numeric junk silently becomes 0 and can also surface as an inverted range.","commonSituations":"Copying a config tuned for another implementation that allows longer histories, off-by-one when computing R from a window length, or non-numeric tokens silently parsing to 0 via atoi.","solutions":["Clamp ranges to 0..128 and ensure L <= R, e.g. '2-128|8'","If you need R > 128 you must modify the C++ cap and rebuild — it is a hard limit","Ensure range tokens are plain decimal integers so atoi parses them as intended"],"exampleFix":"# before\nparam.resetBatchReturnTokenNum(\"4-200|3\")\n\n# after\nparam.resetBatchReturnTokenNum(\"4-128|3\")","handlingStrategy":"validation","validationCode":"for s in cfg.split():\n    (l, r), v = map(int, s.replace(\"|\", \"-\").split(\"-\")), 0\n    l, r = (int(x) for x in s.split(\"|\")[0].split(\"-\"))\n    assert 0 <= l <= r <= 128, f\"range out of bounds in {s!r}\"","typeGuard":"def ranges_in_bounds(cfg: str) -> bool:\n    for s in cfg.split():\n        l, r = (int(x) for x in s.split(\"|\")[0].split(\"-\"))\n        if not (0 <= l <= r <= 128):\n            return False\n    return True","tryCatchPattern":"try:\n    param.resetBatchReturnTokenNum(cfg)\nexcept RuntimeError as e:\n    if \"invalid range\" in str(e):\n        raise ValueError(\"ngram ranges must satisfy L<=R<=128\") from e\n    raise","preventionTips":["Clamp max history length to 128 when tuning","Validate numeric bounds before the C++ call","Remember atoi silently maps junk to 0 — reject non-numeric tokens early"],"tags":["ngram","config","range","bounds-check"],"backgroundTag":"config-value-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}