FIX ResendRequest and SequenceReset: reading a sequence gap
Each side of a FIX session numbers its messages. When a number is missing, the other side asks for it again. Here is a real session with three gaps, read message by message: one resent, one filled, one never filled.
How a sequence gap happens
Each side counts the messages it sends in MsgSeqNum (34), from 1 after a reset. The receiver expects the next number. If a higher number arrives, messages are missing: that is a sequence gap. If a lower number arrives without PossDupFlag (43=Y), the session is out of step, and most engines log out with a text such as “MsgSeqNum too low, expecting 120 but received 101”.
Gaps happen after a reconnect, when one side restarts with its old sequence store, or when messages are lost between the two engines.
A session with three gaps
This session log is one of the test files of the extension (fictitious CompIDs SA and SB):
8=FIX.4.4|9=43|35=0|34=2|49=SA|52=20261105-08:00:03|56=SB|10=043| 8=FIX.4.4|9=43|35=0|34=5|49=SA|52=20261105-08:00:04|56=SB|10=047| 8=FIX.4.4|9=52|35=2|34=2|49=SB|52=20261105-08:00:05|56=SA|7=3|16=0|10=172| 8=FIX.4.4|9=96|35=D|34=3|49=SA|52=20261105-08:00:06|56=SB|43=Y|122=20261105-08:00:01|11=R3|55=X|54=1|38=1|40=1|10=033| 8=FIX.4.4|9=96|35=D|34=4|49=SA|52=20261105-08:00:07|56=SB|43=Y|122=20261105-08:00:01|11=R4|55=X|54=1|38=1|40=1|10=036| 8=FIX.4.4|9=43|35=0|34=6|49=SA|52=20261105-08:00:08|56=SB|10=052| 8=FIX.4.4|9=43|35=0|34=9|49=SA|52=20261105-08:00:09|56=SB|10=056| 8=FIX.4.4|9=52|35=2|34=3|49=SB|52=20261105-08:00:10|56=SA|7=7|16=8|10=181| 8=FIX.4.4|9=59|35=4|34=7|49=SA|52=20261105-08:00:11|56=SB|43=Y|123=Y|36=9|10=069| 8=FIX.4.4|9=50|35=1|34=4|49=SB|52=20261105-08:00:12|56=SA|112=T1|10=131| 8=FIX.4.4|9=44|35=0|34=10|49=SA|52=20261105-08:00:13|56=SB|10=092| 8=FIX.4.4|9=43|35=0|34=4|49=SA|52=20261105-08:00:14|56=SB|10=047| 8=FIX.4.4|9=44|35=0|34=12|49=SA|52=20261105-08:00:15|56=SB|10=096| 8=FIX.4.4|9=54|35=2|34=5|49=SB|52=20261105-08:00:16|56=SA|7=11|16=11|10=020| 8=FIX.4.4|9=55|35=4|34=6|49=SB|52=20261105-08:00:17|56=SA|123=N|36=20|10=102| 8=FIX.4.4|9=44|35=0|34=20|49=SB|52=20261105-08:00:18|56=SA|10=098|
Message by message
- SA sends 34=2, then 34=5: messages 3 and 4 are missing.
- SB sends a ResendRequest (35=2) with BeginSeqNo 7=3 and EndSeqNo 16=0. 16=0 means “everything from 3 onwards”.
- SA resends 3 and 4 with PossDupFlag 43=Y and OrigSendingTime (122): the gap is filled by the messages themselves.
- SA jumps from 6 to 9. SB asks for 7 to 8 (7=7, 16=8). SA answers with a SequenceReset (35=4) with GapFillFlag 123=Y and NewSeqNo 36=9: messages 7 and 8 were heartbeats or other admin messages that are not resent, and the next number is 9.
- SA sends 34=4 when 11 is expected: MsgSeqNum too low, without PossDupFlag.
- SA jumps from 10 to 12. SB asks for 11 (7=11, 16=11) and no answer follows in this log.
- SB sends a SequenceReset-Reset (35=4, 123=N, 36=20) and goes on at 34=20: a reset, not a gap fill. Messages between are skipped for good.
Gap fill or reset
- SequenceReset with GapFillFlag 123=Y: replaces messages that do not need to be sent again. It carries the MsgSeqNum of the first message it replaces and the next number in NewSeqNo (36).
- SequenceReset-Reset (123=N or absent): forces the next number, whatever was expected. Used to recover a session; anything in between is lost.
- Logon with ResetSeqNumFlag 141=Y: both sides start again from 1, often at the start of each trading day.
The free version of FIX Protocol Log Analyzer counts all of this for each session: “Pro: 3 sequence gaps, 3 ResendRequests, 2 SequenceResets, 1 MsgSeqNum too low.” Pro gives the detail:
SA → SB: last in-order MsgSeqNum 10, next expected 13 Gap 3–4: Resent (PossDupFlag 43=Y) Gap 7–8: Filled by SequenceReset (123=Y) Gap 11–11: Not filled in this log MsgSeqNum 4 received, 11 expected ResendRequest 3–∞ by SB — answered ResendRequest 7–8 by SB — answered ResendRequest 11–11 by SB — no answer in this log
FIX message example: an order and its ExecutionReport, tag by tag
Frequently asked questions
What does EndSeqNo 16=0 mean in a ResendRequest?
From FIX 4.2 on, 0 means infinity: resend every message from BeginSeqNo (7) to the last one sent.
Why are some messages answered with a SequenceReset instead of being resent?
Admin messages such as Heartbeat, TestRequest or Logon are not resent; a SequenceReset gap fill (123=Y) stands for them. Many engines also let the application skip a stale order this way.
How do I find the last good sequence number?
Take the last MsgSeqNum received in order from each side, before the first unfilled gap. In FIX Protocol Log Analyzer Pro, the session view gives it for each direction, with the next number expected.
See the sequence gaps of your own FIX sessions
FIX Protocol Log Analyzer for VS Code decodes every message of your QuickFIX, QuickFIX/J or QuickFIX/n log, explains every reject in plain words and gives the last status of every order, on your machine. Free, no account; Pro follows each order through its replaces and cancels, details the sequence gaps and writes an anonymized copy.