{"record":{"id":"14f28e95b915aa81","repo":"dotnet/aspnetcore","slug":"invalid-payload-for-sequence-message","errorCode":null,"errorMessage":"Invalid payload for Sequence message.","messagePattern":"Invalid payload for Sequence message\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts","lineNumber":279,"sourceCode":"        return completionMessage;\n    }\n\n    private _createAckMessage(properties: any[]): HubMessage {\n        // check minimum length to allow protocol to add items to the end of objects in future releases\n        if (properties.length < 1) {\n            throw new Error(\"Invalid payload for Ack message.\");\n        }\n\n        return {\n            sequenceId: properties[1],\n            type: MessageType.Ack,\n        } as HubMessage;\n    }\n\n    private _createSequenceMessage(properties: any[]): HubMessage {\n        // check minimum length to allow protocol to add items to the end of objects in future releases\n        if (properties.length < 1) {\n            throw new Error(\"Invalid payload for Sequence message.\");\n        }\n\n        return {\n            sequenceId: properties[1],\n            type: MessageType.Sequence,\n        } as HubMessage;\n    }\n\n    private _writeInvocation(invocationMessage: InvocationMessage): ArrayBuffer {\n        let payload: any;\n        if (invocationMessage.streamIds) {\n            payload = this._encoder.encode([MessageType.Invocation, invocationMessage.headers || {}, invocationMessage.invocationId || null,\n            invocationMessage.target, invocationMessage.arguments, invocationMessage.streamIds]);\n        } else {\n            payload = this._encoder.encode([MessageType.Invocation, invocationMessage.headers || {}, invocationMessage.invocationId || null,\n            invocationMessage.target, invocationMessage.arguments]);\n        }\n","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts#L261-L297","documentation":"Thrown by _createSequenceMessage when the decoded properties array has fewer than 1 element. Sequence messages ([MessageType.Sequence, sequenceId]) carry the sequence ID used by the reliable protocol to resync after reconnect. This is a defensive guard against a degenerate decode and is effectively unreachable in normal operation.","triggerScenarios":"A frame whose first element matched MessageType.Sequence but the array length is reported as 0 — only with a misbehaving/patched decoder or a corrupted buffer; concurrent mutation of a shared ArrayBuffer.","commonSituations":"Not normally seen; only with heavy corruption or a patched msgpack decoder; rare.","solutions":["Treat as unrecoverable corruption and reconnect.","Confirm reliable-protocol support and version alignment on both ends.","Ensure the underlying ArrayBuffer is not shared/mutated concurrently.","Log raw bytes for forensic review."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const messages = protocol.parseMessages(buffer, logger);\n} catch (e) {\n  if (/Sequence message/.test(e.message)) {\n    logger.log(LogLevel.Error, 'Degenerate Sequence frame; reconnecting.');\n    await connection.start();\n  } else throw e;\n}","preventionTips":["Treat as unrecoverable corruption (defensive guard).","Confirm reliable-protocol version alignment on both ends.","Avoid concurrent mutation of the shared ArrayBuffer."],"tags":["messagepack","sequence-message","reliable","validation","parsing"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}