HL7 v2 ERR-2 (Error Location): Format, Values, and Testing Notes
ERR-2 is the field that tells a developer exactly where to look in a rejected message instead of re-reading the whole thing line by line, and generators that leave it blank turn a precise diagnostic tool into a guessing game.
ERR-2 is the Error Location field. It is a composite value that names the segment ID, the segment occurrence number if the segment repeats, the field position within that segment, and optionally the component and sub-component position, so a receiving application can point directly at the offending piece of data.
What this field contains
Example
A synthetic ERR segment pointing to the third OBX occurrence, fifth field, first repetition, where a numeric value was malformed.
Where this trips people up
Teams building error-handling logic often assume ERR-2 will always resolve to a single, unambiguous segment and field, then get surprised the first time a repeating segment like OBX or DG1 is involved and the location pointer needs the occurrence number to mean anything. Test data that only ever triggers errors on non-repeating segments like PID never exercises that occurrence-counting logic, so it breaks the first time a real message with ten OBX segments fails validation on the seventh one.