dotnet/aspnetcore · error · Error

Invalid payload for Ping message.

Error message

Invalid payload for Ping message.

What it means

Thrown by _createPingMessage when the decoded properties array has fewer than 1 element. A Ping message is encoded as [MessageType.Ping] — just the type byte. If properties.length < 1, the frame was completely empty, which is impossible for a valid Ping (the type byte alone makes length 1).

Solutions

  1. Do not call _createPingMessage directly with empty input; this is an internal invariant guard.
  2. If hit, inspect upstream: the length-0 guard in _parseMessage should have fired first.
  3. Report as a protocol bug if observed in the wild — indicates corrupted frame routing.
Defensive patterns

Strategy: validation

Validate before calling

// Internal invariant — protect by upstream guard in _parseMessage
if (input.length === 0) throw new Error('Empty Ping payload');
// _createPingMessage will then never receive an empty array.

Type guard

function isNonEmptyArray(a: unknown[]): boolean { return a.length >= 1; }

Try / catch

// not user-facing — surfaced only through _parseMessage which already rejects length 0

Prevention

When it happens

Trigger: Effectively unreachable in normal operation because _parseMessage already rejects length-0 inputs (error 110). Could surface only if _parseMessage's check is bypassed or if properties was mis-routed to _createPingMessage with an empty array.

Common situations: Direct unit testing of _createPingMessage with empty arrays; a fork that modified the upstream _parseMessage length guard; hypothetical protocol corruption that also slips past the upstream check.

Related errors


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

Appendix: source

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

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

        return {
            // Close messages have no headers.
            allowReconnect: properties.length >= 3 ? properties[2] : undefined,
            error: properties[1],
            type: MessageType.Close,
        } as HubMessage;
    }

    private _createPingMessage(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 Ping message.");
        }

        return {
            // Ping messages have no headers.
            type: MessageType.Ping,
        } as HubMessage;
    }

    private _createInvocationMessage(headers: MessageHeaders, properties: any[]): InvocationMessage {
        // check minimum length to allow protocol to add items to the end of objects in future releases
        if (properties.length < 5) {
            throw new Error("Invalid payload for Invocation message.");
        }

        const invocationId = properties[2] as string;
        if (invocationId) {
            return {
                arguments: properties[4],

View on GitHub (pinned to 3600ca084e)