dotnet/aspnetcore · 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 is the simplest frame ([MessageType.Ping]) and only needs the type byte, so hitting this means the properties array was unexpectedly empty after the type was already read as messageType — essentially an unreachable defensive guard for a degenerate decode result.

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

Solutions

  1. Treat as unrecoverable corruption: log and reconnect.
  2. Ensure @msgpack/msgpack is at the supported version and not patched/overridden via MessagePackOptions.
  3. Verify the binary buffer hasn't been mutated concurrently (no shared ArrayBuffer being written from another thread).
  4. Capture the frame bytes for forensic analysis.
Defensive patterns

Strategy: try-catch

Try / catch

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

Prevention

When it happens

Trigger: Effectively only reachable if the msgpack decoder returns an array shorter than the one used to read messageType, which cannot happen in normal flow; in practice indicates memory corruption or a patched decoder.

Common situations: Not seen in normal operation; appears only with a tampered/misbehaving msgpack decoder or heavily corrupted input where the array length is inconsistent.

Related errors


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