dotnet/aspnetcore · error
Invalid payload for Invocation message.
Error message
Invalid payload for Invocation message.
What it means
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.
Source
Thrown at src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts:190
} 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],
headers,
invocationId,
streamIds: [],
target: properties[3] as string,
type: MessageType.Invocation,
};
} else {
return {
arguments: properties[4],
headers,
streamIds: [],
target: properties[3],View on GitHub (pinned to 294cab2f9b)
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.
Example fix
// before
connection.on('Send', x => {}); // server sends short frame -> parseMessages throws
// after
try {
// parseMessages called internally by the connection
} catch (e) {
if (/Invocation message/.test(e.message)) {
logger.log(LogLevel.Error, 'Malformed Invocation from server; reconnecting.');
await connection.start();
}
} Defensive patterns
Strategy: try-catch
Try / catch
try {
const messages = protocol.parseMessages(buffer, logger);
} catch (e) {
if (/Invocation message/.test(e.message)) {
logger.log(LogLevel.Error, 'Malformed Invocation frame; reconnecting.');
await connection.start();
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Server/client version skew; a server-side hub method invocation serialized incorrectly due to a custom protocol/serializer; frame truncation on the wire.
Related errors
- Invalid payload for Completion message.
- Invalid payload for Close message.
- Invalid payload for Ping message.
- Invalid payload for StreamItem message.
- Invalid payload for Ack message.
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/b34b4e26d6466794.
Report an issue: GitHub.