dotnet/aspnetcore · error · Error

Invalid payload for Sequence message.

Error message

Invalid payload for Sequence message.

What it means

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.

Solutions

  1. Do not call _createSequenceMessage directly with empty input.
  2. If observed, audit upstream guards in _parseMessage.
  3. Verify both peers agree on enabling the reliable-stream (Sequence/Ack) extension.
Defensive patterns

Strategy: validation

Validate before calling

function isValidSequenceProperties(p: unknown[]): boolean {
  return p.length >= 2; // require the sequenceId slot at index 1
}

Type guard

function isSequencePayload(p: unknown[]): p is [number, number] {
  return p.length >= 2 && typeof p[1] === 'number';
}

Try / catch

// Internal — surfaced via _parseMessage flow. Any Sequence-frame parse failure should stop and re-establish the connection.

Prevention

When it happens

Trigger: 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.

Common situations: Direct unit tests; forked/modified upstream guards; reliable-stream protocol corruption defeating earlier checks.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/14f28e95b915aa81. Report an issue: GitHub.

Appendix: source

Thrown at src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts:279

        return completionMessage;
    }

    private _createAckMessage(properties: any[]): HubMessage {
        // check minimum length to allow protocol to add items to the end of objects in future releases
        if (properties.length < 1) {
            throw new Error("Invalid payload for Ack message.");
        }

        return {
            sequenceId: properties[1],
            type: MessageType.Ack,
        } as HubMessage;
    }

    private _createSequenceMessage(properties: any[]): HubMessage {
        // check minimum length to allow protocol to add items to the end of objects in future releases
        if (properties.length < 1) {
            throw new Error("Invalid payload for Sequence message.");
        }

        return {
            sequenceId: properties[1],
            type: MessageType.Sequence,
        } as HubMessage;
    }

    private _writeInvocation(invocationMessage: InvocationMessage): ArrayBuffer {
        let payload: any;
        if (invocationMessage.streamIds) {
            payload = this._encoder.encode([MessageType.Invocation, invocationMessage.headers || {}, invocationMessage.invocationId || null,
            invocationMessage.target, invocationMessage.arguments, invocationMessage.streamIds]);
        } else {
            payload = this._encoder.encode([MessageType.Invocation, invocationMessage.headers || {}, invocationMessage.invocationId || null,
            invocationMessage.target, invocationMessage.arguments]);
        }

View on GitHub (pinned to 3600ca084e)