Mule application using the Health Level 7 (HL7) connector Read operation, fails to parse an incoming HL7 data with error "fatal message error: required segment missing".
Error from logs:
ERROR 2021-10-14 19:17:23,881 [[MuleRuntime].uber.02: [hl7-test-api].hl7-test-apiFlow.BLOCKING @4f71b7e3] [processor: ; event: 08b79ef1-2d5e-11ec-aebe-f01898971dd7] com.mulesoft.flatfile.schema.hl7.HL7SchemaParser: fatal message error: required segment missing: EVN at segment 1 (MSH) of message 00000006 ERROR 2021-10-14 19:17:23,882 [[MuleRuntime].uber.02: [hl7-test-api].hl7-test-apiFlow.BLOCKING @4f71b7e3] [processor: ; event: 08b79ef1-2d5e-11ec-aebe-f01898971dd7] com.mulesoft.flatfile.schema.hl7.HL7SchemaParser: fatal message error: required segment missing: PID at segment 1 (MSH) of message 00000006 ERROR 2021-10-14 19:17:23,882 [[MuleRuntime].uber.02: [hl7-test-api].hl7-test-apiFlow.BLOCKING @4f71b7e3] [processor: ; event: 08b79ef1-2d5e-11ec-aebe-f01898971dd7] com.mulesoft.flatfile.schema.hl7.HL7SchemaParser: fatal message error: required segment missing: MRG at segment 1 (MSH) of message 00000006
{Errors=[HL7Error(2,true,ErrorSegmentSequence,100,required segment missing)], Delimiters=|^~\&, MSH={MSH-05={HD-01=RSP1P8}, MSH-06={HD-01=MCM}, MSH-17=MR1, MSH-07={TS-01=199601051530}, MSH-08=SEC, MSH-19={CE-01=RODRIGUEZ, CE-02=JOHN}, MSH-09={CM_MSG-02=A49, CM_MSG-01=ADT}, MSH-10=00000006, MSH-11={PT-01=P}, MSH-12=2.3
EVN, MSH-13=49, MSH-03={HD-01=REGADT}, MSH-14=199601051530
PID, MSH-04={HD-01=MCM}}, ACK={MSH={MSH-05={HD-01=REGADT}, MSH-06={HD-01=MCM}, MSH-17=MR1, MSH-07={TS-01=199601051530}, MSH-08=SEC, MSH-19={CE-01=RODRIGUEZ, CE-02=JOHN}, MSH-09={CM_MSG-02=A49, MSG-03=ACK, CM_MSG-01=ACK}, MSH-10=00000006, MSH-11={PT-01=P}, MSH-12=2.3
EVN, MSH-13=49, MSH-03={HD-01=RSP1P8}, MSH-14=199601051530
PID, MSH-04={HD-01=MCM}}, ERR=[{ERR-01=[{ELD-04={CE-01=102, CE-02=Data type error, CE-03=HL70357}, ELD-01=MSH, ELD-02=0, ELD-03=13}]}, {ERR-01=[{ELD-04={CE-01=102, CE-02=Data type error, CE-03=HL70357}, ELD-01=MSH, ELD-02=0, ELD-03=13}]}, {ERR-01=[{ELD-04={CE-01=100, CE-02=Segment sequence error, CE-03=HL70357}, ELD-01=EVN, ELD-02=1}]}, {ERR-01=[{ELD-04={CE-01=100, CE-02=Segment sequence error, CE-03=HL70357}, ELD-01=PID, ELD-02=1}]}, {ERR-01=[{ELD-04={CE-01=100, CE-02=Segment sequence error, CE-03=HL70357}, ELD-01=MRG, ELD-02=1}]}], MSA={MSA-02=00000006, MSA-01=AR}}, Data={ADT_A49={MSH={MSH-05={HD-01=RSP1P8}, MSH-06={HD-01=MCM}, MSH-17=MR1, MSH-07={TS-01=199601051530}, MSH-08=SEC, MSH-19={CE-01=RODRIGUEZ, CE-02=JOHN}, MSH-09={CM_MSG-02=A49, CM_MSG-01=ADT}, MSH-10=00000006, MSH-11={PT-01=P}, MSH-12=2.3
EVN, MSH-13=49, MSH-03={HD-01=REGADT}, MSH-14=199601051530
PID, MSH-04={HD-01=MCM}}}}, Id=ADT_A49, Name=ADT_A49}The Anypoint Connector for HL7 message parsing depends on the Message segment terminator that is coming in the incoming data and what is configured in the connector.
While copying the HL7 data from the file to the postman or any other REST client, there are chances that the segment terminator values got altered and caused the issue with the HL7 connector.
The message segment terminator that is coming in the incoming data should match with the HL7 connector parser configurations as shown here:
Segment terminator Hex decimal value
LF 0A
CR 0D
HL7 Connector configuration:
Hex Dump of the Input file :
001122637

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.