dotnet/aspnetcore · error
Invalid payload for Completion message.
Error message
Invalid payload for Completion message.
What it means
Thrown by _createCompletionMessage when the decoded properties array has fewer than 4 elements. A Completion frame is [MessageType.Completion, headers, invocationId, resultKind, ...] so it needs at least the type, headers, invocationId, and resultKind. This guard fires before resultKind is inspected.
Source
Thrown at src/SignalR/clients/ts/signalr-protocol-msgpack/src/MessagePackHubProtocol.ts:232
private _createStreamItemMessage(headers: MessageHeaders, properties: any[]): StreamItemMessage {
// check minimum length to allow protocol to add items to the end of objects in future releases
if (properties.length < 4) {
throw new Error("Invalid payload for StreamItem message.");
}
return {
headers,
invocationId: properties[2],
item: properties[3],
type: MessageType.StreamItem,
} as StreamItemMessage;
}
private _createCompletionMessage(headers: MessageHeaders, properties: any[]): CompletionMessage {
// check minimum length to allow protocol to add items to the end of objects in future releases
if (properties.length < 4) {
throw new Error("Invalid payload for Completion message.");
}
const resultKind = properties[3];
if (resultKind !== this._voidResult && properties.length < 5) {
throw new Error("Invalid payload for Completion message.");
}
let error: string | undefined;
let result: any;
switch (resultKind) {
case this._errorResult:
error = properties[4];
break;
case this._nonVoidResult:
result = properties[4];
break;View on GitHub (pinned to 294cab2f9b)
Solutions
- Align SignalR client and server versions.
- Verify the server isn't a custom/non-ASP.NET implementation producing non-standard Completion frames.
- Catch and treat as a failed invocation; surface the error to the caller of connection.invoke.
- Inspect server logs for the completing hub method.
Example fix
// before
const result = await connection.invoke('DoWork');
// server sends short Completion -> throws
// after
try {
const result = await connection.invoke('DoWork');
} catch (e) {
logger.log(LogLevel.Error, 'Invoke failed (possibly malformed Completion): ' + e.message);
await reconnect();
} Defensive patterns
Strategy: try-catch
Try / catch
try {
const result = await connection.invoke('DoWork');
} catch (e) {
if (/Completion message/.test(e?.message)) {
logger.log(LogLevel.Error, 'Malformed Completion frame; reconnecting.');
await connection.start();
} else throw e;
} Prevention
- Align client/server SignalR versions so Completion frames carry the expected fields.
- Wrap connection.invoke calls in try/catch and surface/handle malformed-frame errors.
- Inspect server logs for the completing hub method when this recurs.
When it happens
Trigger: Server sends a Completion frame missing the resultKind (properties[3]); frame corruption removes trailing elements; protocol version mismatch.
Common situations: Version skew; a server-side hub method returns and the Completion frame is serialized without the resultKind byte; network truncation.
Related errors
- Invalid payload for Invocation 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/4bedeae609815013.
Report an issue: GitHub.