The Path
Module 5 · The integrator’s job·13 min
Troubleshooting: the usual suspects
Delimiter, shifted field, date, encoding, duplicate, lost ACK: the classics.
Interfaces always break in the same ways. After a few years you recognise the failures at a glance: a shifted field, a date the wrong way round, a mangled accent. This lesson walks through the classics, one broken message at a time, then gives you a method.
Start with this one. The hospital record shows an odd date of birth. Click PID-7.
Admission received at the sleep lab. Something is off in the PID: count the bars.
1. The shifted field
PID-7 is F. The date of birth went into PID-6, the mother’s maiden name field. One bar | is missing between the name and the date. Every following value lands one slot early.
The reflex: count the bars, not the values. Click Edit, add a | after DUBOIS^Marie, and watch PID-7 get its date back. This shift often comes from a transformation rule that drops an empty field instead of keeping it, or from a script that builds the segment by hand instead of using a library or the interface engine.
2. The broken delimiter
The program building this message lost the backslash in MSH-2.
MSH-2 must hold four characters in this order: component, repetition, escape, subcomponent. Only three are left here: ^~&. The backslash is gone, often swallowed by a programming language that treats it as special. A strict receiver refuses the message. Another one takes & as the escape character, and what follows becomes unpredictable.
A close cousin: a delimiter inside the data. A text like “apneas & hypopneas” or a | in a comment breaks the parsing. The standard provides escape sequences: \F\ for the bar, \S\ for the caret, \T\ for the ampersand, \R\ for the tilde, \E\ for the backslash. The reverse trap exists too: a receiver that does not decode these sequences, and the doctor reads apneas \T\ hypopneas on screen.
3. The badly formatted date
The PID arrives with a date of birth written as on a paper form.
HL7 v2.5.1 expects YYYYMMDD, optionally followed by the time and a time zone offset. 12/03/1985 is not an HL7 date. Depending on the receiver, the message is refused, the date is dropped, or worse, it is read as 3 December. Other flavours of the same trap: hyphens (2026-06-27), a time without seconds when the specification requires them, a missing offset. Same family for numbers: in v2, the decimal separator is the point. A 28,5 with a comma in an NM field is refused, or misread.
4. Mangled accents
Marie Dubois’s address, as the receiver displays it.
Santé instead of Santé. That is the signature of text written in UTF-8 and read as ISO-8859-1. In UTF-8, “é” takes two bytes. Read one by one, they become two characters.
MSH-18 declares the character set. Empty, it means 7-bit ASCII, so no accents at all. Here it says 8859/1 while the bytes are UTF-8. Three things must agree: the actual byte encoding, the MSH-18 value (for example UNICODE UTF-8), and the receiver configuration.
In practice, the most frequent case is the other way round: an empty MSH-18, while the bytes are ISO-8859-1 or Windows-1252. The standard says ASCII, reality says Latin-1. As long as both sides make the same assumption, it works. The day one of them moves to UTF-8, the accents break.
5. The missing required field
Validation
- PID-3 PID-3 (Patient Identifier List) is required but empty.
An admission with no patient identifier. Validation flags the gap.
A good receiver answers with an error acknowledgement that says what and where. Click ERR-2, then ERR-3:
The sleep lab reply to the previous message.
ERR-2 gives the address (segment, occurrence, field), ERR-3 the error code from HL7 table 0357, ERR-4 the severity. Always read the acknowledgement before opening the message: it often does half the diagnosis.
| 0357 code | Meaning |
|---|---|
| 100 | Segments out of order or required segment missing |
| 101 | Required field missing |
| 102 | Data type error |
| 103 | Table value not found |
| 200 | Unsupported message type |
| 204 | Unknown key identifier (patient, order) |
| 205 | Duplicate key identifier |
| 207 | Application internal error |
6. The duplicate message ID
The receiver log. The sender restarted and its counter went backwards.
MSH-10 must identify one message uniquely. The receiver echoes it in MSA-2 to say which message it is answering. Here, two different messages carry MSG00075. If the receiver drops IDs it has already seen, Marie Dubois’s new address silently disappears.
The reverse also happens: the same message sent twice, with the same ID, because the acknowledgement did not arrive in time. For an address update, no harm done. For a result or a charge, it is a clinical or financial duplicate.
7. The lost ACK and timeouts
The sender is waiting for the ACK of MSG00076. It receives this one.
MSA-2 is MSG00070, not MSG00076. As far as the sender knows, its message is not acknowledged. It waits, then, once its timeout expires, resends or blocks the queue. The usual causes:
- a slow receiver (busy database) that answers after the sender’s timeout;
- a firewall that cuts connections left open too long;
- an acknowledgement that arrives, but for another message.
Match the sender timeout to the receiver’s real response time, and settle in the specification what happens when it expires: resend, number of retries, alert.
One message blocks all the others. This is the number one failure in operations. On a blocking queue, a single message in AE stops the whole feed: the morning’s admissions no longer reach the lab. The reflex: find the head message, the one causing the block. Fix it and replay it. If you have to set it aside to unblock the queue, do it knowingly: log it, tell the team, and check what the broken order breaks downstream (an update that arrived before its admission, for example).
8. Line endings: CR versus LF
The standard is explicit: the segment terminator is always the carriage return, CR, hex 0D. Not the Unix line feed LF (0A), nor the Windows CR LF pair.
MSH|^~\&|HIS|LELEUX|SLEEPLAB|...|2.5.1 [0D] correct
MSH|^~\&|HIS|LELEUX|SLEEPLAB|...|2.5.1 [0A] the receiver may see a single line
MSH|^~\&|HIS|LELEUX|SLEEPLAB|...|2.5.1 [0D 0A] a stray 0A at the start of the next segment
This trap lives mostly in file-based exchanges and in messages copied from a text editor. The lab on this site accepts every line ending, so it cannot show you this one. To see it, look at the bytes, with a hex editor or the interface engine’s raw log.
9. Accepted but invisible
The sleep lab sends the night’s result. The hospital record answers AA, and yet the doctor cannot find it.
This is the most common ticket of all: “the result is not in the record”. The message is well formed, the ACK is AA, and nothing shows up. Look at PID-3: 1042 instead of 1024, two digits swapped at data entry. The hospital record does not know that number, or does not know order PLACER-7799 in OBR-2. Depending on the software, the result lands in an orphan list nobody checks, or gets filed under the wrong person.
The reflex: when a result is “missing”, look for the patient and the order on the receiver side first. And ask the vendor what their software does with a result for an unknown patient or order: an honest receiver answers AE with code 204 (unknown key identifier) rather than a silent AA.
The method, step by step
| Step | Question | Where to look |
|---|---|---|
| 1. Retrieve | What is the exact message, byte for byte? | Raw engine log, never a retyped copy |
| 2. Locate | Where did it stop: sender, engine, receiver? | Queues, channel status |
| 3. Read the ACK | MSA-1, and what does ERR say? | ACK stored with the message |
| 4. Compare | How does it differ from a message that works? | A successful message of the same type |
| 5. Check the spec | Is the rule respected? | Mapping table, profile |
| 6. Fix in the right place | Source, transformation or receiver? | No engine patch to hide a sender bug |
| 7. Replay and record | Does it go through? Is the cause written down? | Incident log |
Check your understanding
1 of 5The hospital record shows “F” as Marie Dubois’s date of birth, and nothing as her sex. What is the most likely cause?
+50 XPPass the quiz (4 correct answers) to complete the lesson.
Reviewed and checked on 27 September 2026