{"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":"Error","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/3600ca084e9c8b5f4174fc5e747f4c52d2100806/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. A Sequence message (part of SignalR's reliable-stream / reconnection protocol) is encoded as [MessageType.Sequence, ...]; fewer than 1 element means the type slot is missing. As with Ack, the subsequent read of properties[1] means a length-1 array silently yields sequenceId=undefined.","triggerScenarios":"A frame typed as Sequence routed to _createSequenceMessage with an empty array. Like error 118, practically unreachable because _parseMessage rejects length-0 inputs first; serves as an internal invariant.","commonSituations":"Direct unit tests; forked/modified upstream guards; reliable-stream protocol corruption defeating earlier checks.","solutions":["Do not call _createSequenceMessage directly with empty input.","If observed, audit upstream guards in _parseMessage.","Verify both peers agree on enabling the reliable-stream (Sequence/Ack) extension."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function isValidSequenceProperties(p: unknown[]): boolean {\n  return p.length >= 2; // require the sequenceId slot at index 1\n}","typeGuard":"function isSequencePayload(p: unknown[]): p is [number, number] {\n  return p.length >= 2 && typeof p[1] === 'number';\n}","tryCatchPattern":"// Internal — surfaced via _parseMessage flow. Any Sequence-frame parse failure should stop and re-establish the connection.","preventionTips":["Do not call _createSequenceMessage directly with insufficient data.","Confirm both peers agree on enabling the reliable-stream extension.","Reconnect on Sequence-frame corruption."],"tags":["signalr","messagepack","sequence","reliable-stream","invariant"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}