# Correct order of header fields

**URL:** <https://forum.fixtrading.org/t/correct-order-of-header-fields/12680>\
**Category:** General Q&A\
**Tags:** imported, xid\_169926, fix-technology\
**Created:** [December 18, 2012, 4:47pm UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680 "2012-12-18T16:47:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomaspauli\_x](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@thomaspauli\_x](https://forum.fixtrading.org/u/thomaspauli_x)\
**Post date:** [December 18, 2012, 4:47pm UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680/1 "2012-12-18T16:47:36Z")

</div>

Imported from previous forum

---

<div class="post-metadata">

**Author:** ![thomaspauli\_x](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@thomaspauli\_x](https://forum.fixtrading.org/u/thomaspauli_x)\
**Post date:** [December 18, 2012, 4:47pm UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680/2 "2012-12-18T16:47:36Z")

</div>

Hello,

is there a defined order in which the header fields should be ordered? Quickfix throws an exception saying ‘Header fields out of order’ for the following message:

20121218-16:24:11.705 : 8=FIX.4.29=7635=249=XXXXXXX156=YYYYYYY134=286369=26652=20121218-16:24:117=26716=010=139

Thanks,  
Thomas

---

<div class="post-metadata">

**Author:** ![johncameron](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.fixtrading.org/johncameron/32/56_2.png) [@johncameron](https://forum.fixtrading.org/u/johncameron)\
**Post date:** [December 19, 2012, 2:32am UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680/3 "2012-12-19T02:32:57Z")

</div>

I agree with Aaron. In fact I would go further and say that FIX 4.2 DOES require the ordering of the first three fields. Take a trip down memory lane and download the FIX 4.2 spec from [http://www.fixprotocol.org/specifications/FIX.4.2](http://www.fixprotocol.org/specifications/FIX.4.2).

On page 18, describing the Standard Message Header you will see:

Tag Field Name Req’d Comments

8 BeginString Y FIX.4.2 (Always unencrypted, must be first field in message)

9 BodyLength Y (Always unencrypted, must be second field in message)

35 MsgType Y (Always unencrypted, must be third field in message)

Having said that, I don’t see anything wrong with the message you quoted. I don’t why Quickfix would reject it.

John

> FIX 5.0 SP2 Vol 1 page 20 notes:
> 
> “2. The first three fields in the standard header are BeginString (tag #8) followed by BodyLength (tag #9) followed by MsgType (tag #35).”
> 
> So while (I believe and stand to be corrected) 4.2 doesn’t specifically have the same stated requirement it is implied in the docmentation (seee FIX 4.2 pg 23 Std mssg header table) many vendors apply this rule to previous versions to tidy up session management.
> 
> HTH’s
> 
> > Hello,
> > 
> > is there a defined order in which the header fields should be ordered? Quickfix throws an exception saying ‘Header fields out of order’ for the following message:
> > 
> > 20121218-16:24:11.705 : 8=FIX.4.29=7635=249=XXXXXXX156=YYYYYYY134=286369=26652=20121218-16:24:117=26716=010=139
> > 
> > Thanks,  
> > Thomas

---

<div class="post-metadata">

**Author:** ![johncameron](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.fixtrading.org/johncameron/32/56_2.png) [@johncameron](https://forum.fixtrading.org/u/johncameron)\
**Post date:** [December 19, 2012, 2:37am UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680/4 "2012-12-19T02:37:35Z")

</div>

PS: page 18 in MS Word version of spec, page 23 in PDF version.

> I agree with Aaron. In fact I would go further and say that FIX 4.2 DOES require the ordering of the first three fields. Take a trip down memory lane and download the FIX 4.2 spec from [http://www.fixprotocol.org/specifications/FIX.4.2](http://www.fixprotocol.org/specifications/FIX.4.2).
> 
> On page 18, describing the Standard Message Header you will see:
> 
> Tag Field Name Req’d Comments
> 
> 8 BeginString Y FIX.4.2 (Always unencrypted, must be first field in message)
> 
> 9 BodyLength Y (Always unencrypted, must be second field in message)
> 
> 35 MsgType Y (Always unencrypted, must be third field in message)
> 
> Having said that, I don’t see anything wrong with the message you quoted. I don’t why Quickfix would reject it.
> 
> John
> 
> > FIX 5.0 SP2 Vol 1 page 20 notes:
> > 
> > “2. The first three fields in the standard header are BeginString (tag #8) followed by BodyLength (tag #9) followed by MsgType (tag #35).”
> > 
> > So while (I believe and stand to be corrected) 4.2 doesn’t specifically have the same stated requirement it is implied in the docmentation (seee FIX 4.2 pg 23 Std mssg header table) many vendors apply this rule to previous versions to tidy up session management.
> > 
> > HTH’s
> > 
> > > Hello,
> > > 
> > > is there a defined order in which the header fields should be ordered? Quickfix throws an exception saying ‘Header fields out of order’ for the following message:
> > > 
> > > 20121218-16:24:11.705 : 8=FIX.4.29=7635=249=XXXXXXX156=YYYYYYY134=286369=26652=20121218-16:24:117=26716=010=139
> > > 
> > > Thanks,  
> > > Thomas

---

<div class="post-metadata">

**Author:** ![deankauffman](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@deankauffman](https://forum.fixtrading.org/u/deankauffman)\
**Post date:** [December 19, 2012, 3:40am UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680/5 "2012-12-19T03:40:23Z")

</div>

I too think the message is correctly formatted but QuickFIX has some issues regarding exceptions. It might be as simple as BeginSeqNo(7) of this ResendRequest being too high. Have you checked that?  
Dean

> dead right - I was obviously half asleep when I read that page.
> 
> > PS: page 18 in MS Word version of spec, page 23 in PDF version.
> > 
> > > I agree with Aaron. In fact I would go further and say that FIX 4.2 DOES require the ordering of the first three fields. Take a trip down memory lane and download the FIX 4.2 spec from [http://www.fixprotocol.org/specifications/FIX.4.2](http://www.fixprotocol.org/specifications/FIX.4.2).
> > > 
> > > On page 18, describing the Standard Message Header you will see:
> > > 
> > > Tag Field Name Req’d Comments
> > > 
> > > 8 BeginString Y FIX.4.2 (Always unencrypted, must be first field in message)
> > > 
> > > 9 BodyLength Y (Always unencrypted, must be second field in message)
> > > 
> > > 35 MsgType Y (Always unencrypted, must be third field in message)
> > > 
> > > Having said that, I don’t see anything wrong with the message you quoted. I don’t why Quickfix would reject it.
> > > 
> > > John
> > > 
> > > > FIX 5.0 SP2 Vol 1 page 20 notes:
> > > > 
> > > > “2. The first three fields in the standard header are BeginString (tag #8) followed by BodyLength (tag #9) followed by MsgType (tag #35).”
> > > > 
> > > > So while (I believe and stand to be corrected) 4.2 doesn’t specifically have the same stated requirement it is implied in the docmentation (seee FIX 4.2 pg 23 Std mssg header table) many vendors apply this rule to previous versions to tidy up session management.
> > > > 
> > > > HTH’s
> > > > 
> > > > > Hello,
> > > > > 
> > > > > is there a defined order in which the header fields should be ordered? Quickfix throws an exception saying ‘Header fields out of order’ for the following message:
> > > > > 
> > > > > 20121218-16:24:11.705 : 8=FIX.4.29=7635=249=XXXXXXX156=YYYYYYY134=286369=26652=20121218-16:24:117=26716=010=139
> > > > > 
> > > > > Thanks,  
> > > > > Thomas

---

<div class="post-metadata">

**Author:** ![adityakapur](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.fixtrading.org/adityakapur/32/179_2.png) [@adityakapur](https://forum.fixtrading.org/u/adityakapur)\
**Post date:** [December 19, 2012, 4:30pm UTC](https://forum.fixtrading.org/t/correct-order-of-header-fields/12680/6 "2012-12-19T16:30:20Z")

</div>

Try moving the SendingTime field (Tag 52) before the LastMsgSeqNumProcessed field (Tag 369).

> I too think the message is correctly formatted but QuickFIX has some issues regarding exceptions. It might be as simple as BeginSeqNo(7) of this ResendRequest being too high. Have you checked that?  
> Dean
> 
> > dead right - I was obviously half asleep when I read that page.
> > 
> > > PS: page 18 in MS Word version of spec, page 23 in PDF version.
> > > 
> > > > I agree with Aaron. In fact I would go further and say that FIX 4.2 DOES require the ordering of the first three fields. Take a trip down memory lane and download the FIX 4.2 spec from [http://www.fixprotocol.org/specifications/FIX.4.2](http://www.fixprotocol.org/specifications/FIX.4.2).
> > > > 
> > > > On page 18, describing the Standard Message Header you will see:
> > > > 
> > > > Tag Field Name Req’d Comments
> > > > 
> > > > 8 BeginString Y FIX.4.2 (Always unencrypted, must be first field in message)
> > > > 
> > > > 9 BodyLength Y (Always unencrypted, must be second field in message)
> > > > 
> > > > 35 MsgType Y (Always unencrypted, must be third field in message)
> > > > 
> > > > Having said that, I don’t see anything wrong with the message you quoted. I don’t why Quickfix would reject it.
> > > > 
> > > > John
> > > > 
> > > > > FIX 5.0 SP2 Vol 1 page 20 notes:
> > > > > 
> > > > > “2. The first three fields in the standard header are BeginString (tag #8) followed by BodyLength (tag #9) followed by MsgType (tag #35).”
> > > > > 
> > > > > So while (I believe and stand to be corrected) 4.2 doesn’t specifically have the same stated requirement it is implied in the docmentation (seee FIX 4.2 pg 23 Std mssg header table) many vendors apply this rule to previous versions to tidy up session management.
> > > > > 
> > > > > HTH’s
> > > > > 
> > > > > > Hello,
> > > > > > 
> > > > > > is there a defined order in which the header fields should be ordered? Quickfix throws an exception saying ‘Header fields out of order’ for the following message:
> > > > > > 
> > > > > > 20121218-16:24:11.705 : 8=FIX.4.29=7635=249=XXXXXXX156=YYYYYYY134=286369=26652=20121218-16:24:117=26716=010=139
> > > > > > 
> > > > > > Thanks,  
> > > > > > Thomas
