{"record":{"id":"948d3cb133103d97","repo":"dotnet/aspnetcore","slug":"invalid-sequenceid-for-sequence-message","errorCode":null,"errorMessage":"Invalid SequenceId for Sequence message.","messagePattern":"Invalid SequenceId for Sequence message\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/ts/signalr/src/JsonHubProtocol.ts","lineNumber":129,"sourceCode":"            throw new Error(\"Invalid payload for Completion message.\");\n        }\n\n        if (!message.result && message.error) {\n            this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\n        }\n\n        this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\n    }\n\n    private _isAckMessage(message: AckMessage): void {\n        if (typeof message.sequenceId !== 'number') {\n            throw new Error(\"Invalid SequenceId for Ack message.\");\n        }\n    }\n\n    private _isSequenceMessage(message: SequenceMessage): void {\n        if (typeof message.sequenceId !== 'number') {\n            throw new Error(\"Invalid SequenceId for Sequence message.\");\n        }\n    }\n\n    private _assertNotEmptyString(value: any, errorMessage: string): void {\n        if (typeof value !== \"string\" || value === \"\") {\n            throw new Error(errorMessage);\n        }\n    }\n}\n","sourceCodeStart":111,"sourceCodeEnd":139,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/SignalR/clients/ts/signalr/src/JsonHubProtocol.ts#L111-L139","documentation":"Thrown by JsonHubProtocol._isSequenceMessage when a Sequence message's `sequenceId` is not of type `number`. Sequence messages tell the receiver how many messages to expect before an Ack; a non-numeric sequenceId cannot be honored and is rejected.","triggerScenarios":"Receiving a JSON message with `type` corresponding to Sequence but `sequenceId` is missing, a string, null, or otherwise non-number. Typically caused by a malformed or version-mismatched server frame in a stateful-reconnect session.","commonSituations":"Stateful reconnect enabled on one peer only, a server implementation that emits sequenceId as a string, or a proxy that alters the field.","solutions":["Match the stateful-reconnect extension version between client and server.","Verify the Sequence frame includes a numeric sequenceId before transmission.","Remove any middleware that re-encodes numeric fields as strings."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"function validSequence(m: any): boolean {\n  return typeof m?.sequenceId === \"number\";\n}","typeGuard":"function isNumericSequenceId(m: any): m is { sequenceId: number } {\n  return !!m && typeof m.sequenceId === \"number\" && Number.isFinite(m.sequenceId);\n}","tryCatchPattern":null,"preventionTips":["Match the stateful-reconnect extension version across peers.","Send sequenceId as a number, not a string.","Avoid middleware that re-encodes numeric fields."],"tags":["protocol","json","sequence","stateful-reconnect","parsing"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}