Problem
The error “ MSH segment is either missing or not at the start" indicates that after parsing an HL7 message with hl7.parse, the MSH segment could not be found or is not at the start.
Causes
-
MSH segment is missing.
-
MSH segment is not the first segment.
-
There is whitespace or character(s) before the MSH segment.
-
MSH segment is not defined or is not the first child for the corresponding message definition in the vmd.
-
MSH segment is not defined as a child in the catchall message definition, even if the inbound message is not filtered by the catchall.
Case 5 is only applicable on IguanaX versions 10.1.112 and below.
Solutions
Case 1 - Verify MSH segment is not missing
Review the HL7 message for verification. The MSH segment must exist before parsing.
Case 2 - Verify MSH is the first segment
Review the HL7 message for verification. The MSH segment must be the first segment.
Case 3 - Verify there are no characters in front of the MSH segment
To confirm there are no characters in front of the MSH segment:
-
Find the message in the logs.
-
Double click the message, or click the […] on the right side of the logged message to go into detailed view for the message.
-
Verify there are no characters in front of the HL7 message.
-
You can also change the view to “View as Hexadecimal”. The message must begin with
4D 53 48 7C→ that isMSH|at byte 0.
Example: HL7 Message with no characters in front in Hexadecimal view
![]()
Example: HL7 Message with a whitespace character in front in Hexadecimal view
![]()
Case 4 - Review the .vmd file to verify the MSH segment exists as the first child for the corresponding message definition
To review the vmd file for the inbound message's corresponding message definition:
-
Click on the .vmd file.
-
Click on the corresponding message definition (i.e. “ADT”) to view it.
![]()
-
Ensure MSH segment exists and is the first child defined.
![]()
Case 5 - Review the .vmd file to verify the MSH segment exists as the first child in the catchall message definition
There is a bug in versions 10.1.112 and below where the inbound message unexpectedly throws this error during parsing, even when the HL7 message has a correct MSH segment.
![]()
This is because the catchall message definition in the vmd file does not have an existing MSH child or it is not the first child defined.
Option 1 (Recommended) Upgrading to the latest IguanaX version will resolve this issue
This is a bug on versions 10.1.112 and below.
Option 2 Add the MSH segment to the catchall message definition
Review the vmd file to ensure a MSH segment exists and is defined as the first child for the Catchall message definition.
![]()