dotnet/aspnetcore · error · Error

Invalid payload for Ack message.

Error message

Invalid payload for Ack message.

What it means

Thrown by _createAckMessage when the decoded properties array has fewer than 1 element. An Ack message is part of SignalR's reliable-stream protocol and is encoded with MessageType.Ack as the first element plus a sequenceId; properties.length < 1 means even the type slot is absent. Note the subsequent read of properties[1] means a length-1 array will silently yield sequenceId=undefined — a separate quirk to be aware of.

Solutions

  1. Do not invoke _createAckMessage directly with empty input; rely on _parseMessage to gate.
  2. If observed in production, investigate why the upstream length guard did not fire.
  3. Confirm reliable-stream protocol is enabled consistently on both peers.
Defensive patterns

Strategy: validation

Validate before calling

// Internal invariant — protect via upstream guard
function isValidAckProperties(p: unknown[]): boolean {
  return p.length >= 2; // also recommend requiring the sequenceId slot
}

Type guard

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

Try / catch

// Internal — surfaced via _parseMessage's parsing flow; treat any such failure as connection-poisoning and reconnect.

Prevention

When it happens

Trigger: A frame typed as Ack routed to _createAckMessage with an empty array; only reachable if the upstream length-0 guard in _parseMessage is bypassed. Practically an internal invariant guard.

Common situations: Direct unit tests of _createAckMessage; a fork that modified _parseMessage; hypothetical corruption that also defeats the upstream check.

Related errors


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

Appendix: source

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

                result = properties[4];
                break;
        }

        const completionMessage: CompletionMessage = {
            error,
            headers,
            invocationId: properties[2],
            result,
            type: MessageType.Completion,
        };

        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;

View on GitHub (pinned to 3600ca084e)