{"record":{"id":"b34b4e26d6466794","repo":"dotnet/aspnetcore","slug":"invalid-payload-for-invocation-message","errorCode":null,"errorMessage":"Invalid payload for Invocation message.","messagePattern":"Invalid payload for Invocation message\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts","lineNumber":190,"sourceCode":"        } 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],\n                headers,\n                invocationId,\n                streamIds: [],\n                target: properties[3] as string,\n                type: MessageType.Invocation,\n            };\n        } else {\n            return {\n                arguments: properties[4],\n                headers,\n                streamIds: [],\n                target: properties[3],","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts#L172-L208","documentation":"Thrown by _createInvocationMessage when the decoded properties array has fewer than 5 elements. A valid Invocation is [MessageType.Invocation, headers, invocationId, target, arguments] (optionally plus streamIds), so five is the minimum. Hitting it means the server sent an Invocation frame missing required fields like target or arguments.","triggerScenarios":"Server emits an Invocation frame with fewer than 5 slots (e.g. omitted arguments array); a partial/corrupted frame after splitting; protocol version mismatch where the server uses an older 4-element Invocation layout.","commonSituations":"Server/client version skew; a server-side hub method invocation serialized incorrectly due to a custom protocol/serializer; frame truncation on the wire.","solutions":["Align SignalR client and server versions so the Invocation frame layout matches.","Inspect server-side logs for the hub method that triggered the malformed invocation.","Verify no middleware serializing/re-encoding the frame is in the path.","Catch and reconnect — a malformed Invocation cannot be recovered in place."],"exampleFix":"// before\nconnection.on('Send', x => {}); // server sends short frame -> parseMessages throws\n\n// after\ntry {\n  // parseMessages called internally by the connection\n} catch (e) {\n  if (/Invocation message/.test(e.message)) {\n    logger.log(LogLevel.Error, 'Malformed Invocation from server; reconnecting.');\n    await connection.start();\n  }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const messages = protocol.parseMessages(buffer, logger);\n} catch (e) {\n  if (/Invocation message/.test(e.message)) {\n    logger.log(LogLevel.Error, 'Malformed Invocation frame; reconnecting.');\n    await connection.start();\n  } else throw e;\n}","preventionTips":["Align client and server SignalR versions, especially for Invocation frame layout.","Inspect server hub methods that serialize unusually.","Catch parse failures and reconnect rather than letting them crash the host."],"tags":["messagepack","invocation-message","validation","parsing","version-skew"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}