dotnet/aspnetcore · 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. 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.

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 294cab2f9b)

Solutions

  1. Treat as unrecoverable corruption and reconnect.
  2. Confirm reliable-protocol support and version alignment on both ends.
  3. Ensure the underlying ArrayBuffer is not shared/mutated concurrently.
  4. Log raw bytes for forensic review.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const messages = protocol.parseMessages(buffer, logger);
} catch (e) {
  if (/Sequence message/.test(e.message)) {
    logger.log(LogLevel.Error, 'Degenerate Sequence frame; reconnecting.');
    await connection.start();
  } else throw e;
}

Prevention

When it happens

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

Common situations: Not normally seen; only with heavy corruption or a patched msgpack decoder; rare.

Related errors


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