dotnet/aspnetcore · error · 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. The Invocation message layout is [MessageType.Invocation, headers, invocationId, target, arguments, streamIds?]. Fewer than 5 means required fields (typically target or arguments) are missing.
Solutions
- Verify the server runs a compatible SignalR MessagePack protocol version.
- Inspect the decoded properties array contents to identify the missing slot.
- Treat as connection-poisoning: close and reconnect.
Example fix
// before
// server emits [1, {}, '42', 'Send'] — missing arguments → throws
// after — server must include all required slots
// emit [1, {}, '42', 'Send', [], []] (arguments, streamIds) Defensive patterns
Strategy: validation
Validate before calling
function isValidInvocationProperties(p: unknown[]): boolean {
return p.length >= 5;
} Type guard
function isInvocationPayload(p: unknown[]): p is [number, unknown, string | null, string, unknown[], unknown[]?] {
return p.length >= 5;
} Try / catch
try { return protocol.parseMessages(buf, logger); }
catch (e) {
if (/Invalid payload for Invocation/.test((e as Error).message)) {
logger.log(LogLevel.Error, 'Malformed Invocation — reconnecting');
await connection.stop(); await connection.start();
} else throw e;
} Prevention
- Verify the server's hub invocation encoder includes target and arguments slots.
- Align client/server SignalR protocol versions.
- Treat malformed invocations as poison and reconnect.
When it happens
Trigger: A server/peer sent an Invocation frame missing the target or arguments slot; corrupt bytes that decoded to an array of length 1-4 but were typed as Invocation; a non-conforming hub method invocation.
Common situations: Protocol version mismatch (older/newer server with a different Invocation layout); corrupted wire data; malicious peer; testing the parser with truncated arrays.
Related errors
- Invalid payload for Close message.
- Invalid payload for Completion message.
- Invalid payload.
- Invalid payload for Ping message.
- Invalid payload for StreamItem message.
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/b34b4e26d6466794.
Report an issue: GitHub.
Appendix: 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 3600ca084e)