dotnet/aspnetcore · error · Error
Invalid SequenceId for Sequence message.
Error message
Invalid SequenceId for Sequence message.
What it means
A Sequence message (type 9) lets the sender resynchronize the receive window with a numeric `sequenceId`. A non-numeric value defeats the resynchronization and is rejected, mirroring the Ack validation.
Source
Thrown at src/SignalR/clients/ts/signalr/src/JsonHubProtocol.ts:129
throw new Error("Invalid payload for Completion message.");
}
if (!message.result && message.error) {
this._assertNotEmptyString(message.error, "Invalid payload for Completion message.");
}
this._assertNotEmptyString(message.invocationId, "Invalid payload for Completion message.");
}
private _isAckMessage(message: AckMessage): void {
if (typeof message.sequenceId !== 'number') {
throw new Error("Invalid SequenceId for Ack message.");
}
}
private _isSequenceMessage(message: SequenceMessage): void {
if (typeof message.sequenceId !== 'number') {
throw new Error("Invalid SequenceId for Sequence message.");
}
}
private _assertNotEmptyString(value: any, errorMessage: string): void {
if (typeof value !== "string" || value === "") {
throw new Error(errorMessage);
}
}
}
View on GitHub (pinned to 294cab2f9b)
Solutions
- Verify sequenceId is emitted as a JSON number by the server.
- Align client and server SignalR versions so the reliable-session extension is consistently implemented.
- Turn off reliable sessions if either side cannot honor them correctly.
- Log the raw message (logMessageContent:true) to inspect the field type.
Example fix
// before
{ "type": 9, "sequenceId": null }
// after
{ "type": 9, "sequenceId": 100 } Defensive patterns
Strategy: type-guard
Validate before calling
function validSequence(m: any): boolean {
return m?.type === 9 && typeof m.sequenceId === 'number';
} Type guard
function isSequenceMessage(m: any): m is { type: 9; sequenceId: number } {
return m?.type === 9 && typeof m.sequenceId === 'number';
} Prevention
- Serialize sequenceId as a JSON number, not a string.
- Keep client and server on matching reliable-session-capable versions.
- Log raw Sequence messages when debugging reliable-transport issues.
When it happens
Trigger: Server sends {"type":9,"sequenceId":null} or a string sequenceId while reliable sessions are active. Caused by version skew or a server bug in the reliable-transport extension.
Common situations: One party negotiates the reliable feature but emits malformed Sequence messages; mixed old/new SignalR packages across a deployment.
Related errors
- Invalid SequenceId for Ack message.
- Invalid input for JSON hub protocol. Expected a string.
- Invalid payload.
- Invalid payload for StreamItem message.
- Invalid payload for Completion message.
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/948d3cb133103d97.
Report an issue: GitHub.