{"record":{"id":"19eebd352650aeff","repo":"dotnet/aspnetcore","slug":"incomplete-message","errorCode":null,"errorMessage":"Incomplete message.","messagePattern":"Incomplete message\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/ts/signalr-protocol-msgpack/src/BinaryMessageFormat.ts","lineNumber":63,"sourceCode":"                numBytes++;\n            }\n            while (numBytes < Math.min(maxLengthPrefixSize, input.byteLength - offset) && (byteRead & 0x80) !== 0);\n\n            if ((byteRead & 0x80) !== 0 && numBytes < maxLengthPrefixSize) {\n                throw new Error(\"Cannot read message size.\");\n            }\n\n            if (numBytes === maxLengthPrefixSize && byteRead > 7) {\n                throw new Error(\"Messages bigger than 2GB are not supported.\");\n            }\n\n            if (uint8Array.byteLength >= (offset + numBytes + size)) {\n                // IE does not support .slice() so use subarray\n                result.push(uint8Array.slice\n                    ? uint8Array.slice(offset + numBytes, offset + numBytes + size)\n                    : uint8Array.subarray(offset + numBytes, offset + numBytes + size));\n            } else {\n                throw new Error(\"Incomplete message.\");\n            }\n\n            offset = offset + numBytes + size;\n        }\n\n        return result;\n    }\n}\n","sourceCodeStart":45,"sourceCodeEnd":72,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/ts/signalr-protocol-msgpack/src/BinaryMessageFormat.ts#L45-L72","documentation":"Thrown by BinaryMessageFormat.parse after the length prefix is successfully read: the declared size plus the prefix length exceeds the available bytes in the input buffer. The frame header promises N payload bytes but fewer than N remain, so the message is incomplete.","triggerScenarios":"The parser received a buffer containing a complete prefix but only part of the payload — typical of streaming transports where a frame is split across reads. The SignalR transport is supposed to buffer whole frames before calling parse, so seeing this means the buffering layer delivered a partial frame or the declared size was wrong.","commonSituations":"Transport buffering regression; proxy truncation; size-prefix corruption declaring a too-large size; reconnect race delivering a buffer mid-frame; a custom host that calls parse on partial buffers.","solutions":["Ensure the transport only hands parse() fully-buffered frames (SignalR's WebSocket transport already does this).","On transient partial frames, reconnect: with proper buffering this is not expected to persist.","Inspect for proxy/intermediary truncation and raise frame-size limits.","If building a custom host, accumulate bytes until at least one full frame (prefix+size) is available before parsing."],"exampleFix":"// before (custom host)\nBinaryMessageFormat.parse(partialBuffer); // partial -> throws\n\n// after (custom host)\nfunction tryParse(buf) {\n  // accumulate until prefix-declared size is present\n  const need = prefixSize + declaredSize;\n  if (buf.byteLength < need) return null; // wait for more\n  return BinaryMessageFormat.parse(buf);\n}","handlingStrategy":"try-catch","validationCode":"function tryParseFrame(buf) {\n  // only parse when at least prefix+declared size are present\n  const need = estimatePrefixSize(buf) + readDeclaredSize(buf);\n  return buf.byteLength >= need ? BinaryMessageFormat.parse(buf) : null;\n}","typeGuard":"null","tryCatchPattern":"try { BinaryMessageFormat.parse(buf); } catch (e) { if (/Incomplete message/i.test(e.message)) { /* buffer more bytes, retry */ } else throw e; }","preventionTips":["Buffer until a full frame is available before parsing.","On transient partials, reconnect rather than retrying the same buffer.","Inspect intermediaries for truncation when this recurs."],"tags":["signalr","messagepack","framing","binary","partial","transport"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}