hl7batch / warning
EL6006
hl7batch.stray-message
Applies to: hl7v2
What it catches and why it matters
MSH appears outside any open batch in a file that uses batch envelopes, so batch-aware readers will not process it. Files with no BHS at all are not checked; bare message streams are valid without an envelope.
Failing example
These synthetic fragments illustrate the defect; they are not complete interchange files. Backslash escapes name bytes such as \r (CR) and \n (LF).
BHS|^~\& BTS|0 MSH|^~\&|EXAMPLE (message is outside the closed batch)
How to fix it
Place the message inside its intended BHS/BTS batch and update the trailer count, or export a bare message stream if batching is not intended.
False positives and limits
Bare message streams without BHS are not checked for stray messages. A feed intentionally mixing batched and bare messages may need a documented exception.
Acknowledgments and suppression
No direct acknowledgment code is mapped for this rule. HL7 ACKs acknowledge individual messages. Batch/file envelope and count errors have no universal ACK code; response batches and error handling depend on the partner agreement. ERR-3 uses Table 0357 and does not determine the acknowledgment status in MSA-1. Sources: https://www.hl7.eu/refactored/ctrl.html (2.10.3.2) https://www.hl7.eu/refactored/segERR.html https://terminology.hl7.org/5.5.0/CodeSystem-v2-0357.html Suppress the rule with --disable EL6006, or list it under "disable" in .edilint.yml. To accept the occurrences a file already has without suppressing the rule, record them with --write-baseline and run with --baseline. Reference: https://crb2nu.github.io/edilint/rules/EL6006.html