{"record":{"id":"c3febb8f7be4cd86","repo":"dotnet/aspnetcore","slug":"invalid-payload-for-ping-message","errorCode":null,"errorMessage":"Invalid payload for Ping message.","messagePattern":"Invalid payload for Ping message\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts","lineNumber":178,"sourceCode":"\n    private _createCloseMessage(properties: any[]): HubMessage {\n        // check minimum length to allow protocol to add items to the end of objects in future releases\n        if (properties.length < 2) {\n            throw new Error(\"Invalid payload for Close message.\");\n        }\n\n        return {\n            // Close messages have no headers.\n            allowReconnect: properties.length >= 3 ? properties[2] : undefined,\n            error: properties[1],\n            type: MessageType.Close,\n        } as HubMessage;\n    }\n\n    private _createPingMessage(properties: any[]): HubMessage {\n        // check minimum length to allow protocol to add items to the end of objects in future releases\n        if (properties.length < 1) {\n            throw new Error(\"Invalid payload for Ping message.\");\n        }\n\n        return {\n            // Ping messages have no headers.\n            type: MessageType.Ping,\n        } as HubMessage;\n    }\n\n    private _createInvocationMessage(headers: MessageHeaders, properties: any[]): InvocationMessage {\n        // check minimum length to allow protocol to add items to the end of objects in future releases\n        if (properties.length < 5) {\n            throw new Error(\"Invalid payload for Invocation message.\");\n        }\n\n        const invocationId = properties[2] as string;\n        if (invocationId) {\n            return {\n                arguments: properties[4],","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts#L160-L196","documentation":"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.","triggerScenarios":"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.","commonSituations":"Not seen in normal operation; appears only with a tampered/misbehaving msgpack decoder or heavily corrupted input where the array length is inconsistent.","solutions":["Treat as unrecoverable corruption: log and reconnect.","Ensure @msgpack/msgpack is at the supported version and not patched/overridden via MessagePackOptions.","Verify the binary buffer hasn't been mutated concurrently (no shared ArrayBuffer being written from another thread).","Capture the frame bytes for forensic analysis."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const messages = protocol.parseMessages(buffer, logger);\n} catch (e) {\n  if (/Ping message/.test(e.message)) {\n    logger.log(LogLevel.Error, 'Degenerate Ping frame; reconnecting.');\n    await connection.start();\n  } else throw e;\n}","preventionTips":["Treat as unrecoverable corruption since the guard is defensive and near-unreachable.","Ensure @msgpack/msgpack is the supported version and not patched.","Avoid sharing the parsed ArrayBuffer with concurrent writers."],"tags":["messagepack","ping-message","validation","parsing","corruption"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}