Skip to main content
Version: v0.1.10

Warning and error codes

Every code on this page is part of the public API. Renaming or removing one is a breaking change, so log pipelines and dashboards can key on them. No warning, error or event carries a run of message content; where a code reports a field, it reports its byte length. The types behind each family are in the API reference.

Framing warnings​

The decoder's and the encoder's codes, of type WarningCode. Each reaches you as an MllpWarning with a byteOffset, or, where it is fatal, as an MllpFramingError with the same code. The one exception is leading whitespace: when it is refused, the error's code is MLLP_MISSING_LEADING_VT, so MLLP_LEADING_WHITESPACE only ever arrives as a warning.

CodeRaised whenWarning or error
MLLP_MISSING_LEADING_VTa frame begins without VTwarning with allowMissingLeadingVt, otherwise an error
MLLP_FS_WITHOUT_CRa frame ends FS with no CRwarning with allowFsOnly, otherwise an error
MLLP_LF_AFTER_FSa line feed follows FSwarning with allowLfAfterFs, otherwise an error
MLLP_LEADING_WHITESPACEpadding precedes VTwarning with allowLeadingWhitespace; never thrown, see below
MLLP_TRAILING_BYTESa VT arrives inside a payload: the bytes before it are discarded and a new frame startsalways a warning; the auto-ACK path never answers it AA
MLLP_EMPTY_PAYLOADnothing lies between VT and FSalways a warning
MLLP_FRAME_TOO_LARGEa frame grows past maxFrameSizeBytes (16 MiB by default)always an error
MLLP_PAYLOAD_CONTAINS_VTthe encoder is given a payload holding 0x0Ban error; a warning with allowDelimiterBytesInPayload
MLLP_PAYLOAD_CONTAINS_FSthe encoder is given a payload holding 0x1Can error; a warning with allowDelimiterBytesInPayload

Without allowLeadingWhitespace, padding before VT is refused with an MllpFramingError whose code is MLLP_MISSING_LEADING_VT, not MLLP_LEADING_WHITESPACE. strict: true makes the first four errors whatever their flags say, and strict leading whitespace is refused with MLLP_MISSING_LEADING_VT too. A framing error on a server or a client closes that one connection, with connectionCause: "framing-fatal", and a client does not reconnect into it. Framing and tolerance explains why.

Correlation warnings​

Raised on the client's warning event, of type AckCorrelationCode. Both are also members of WarningCode. The payload is an AckCorrelationWarning carrying controlIdBytes (the control ID's byte length) and elapsedSinceSendMs; its message is the fixed text ackDiagnosticMessage(code) returns.

CodeRaised when
MLLP_ACK_UNMATCHED_CONTROL_IDan acknowledgment's MSA-2 matches no pending send
MLLP_ACK_AFTER_TIMEOUTan acknowledgment arrives for a send that already timed out; it is dropped

Acknowledgment-mode warnings​

Codes about the enhanced acknowledgment protocol, of type AckModeCode. The client reports them on its warning event as an AckModeWarning; the server reports MLLP_ACK_ACCEPT_TYPE_UNRECOGNISED on its ackModeWarning event. Their text is ackModeDiagnosticMessage(code). None of them refuses or changes a message.

CodeRaised when
MLLP_ACK_ACCEPT_TYPE_UNRECOGNISEDMSH-15 holds a value outside HL7 Table 0155; it is read as its default
MLLP_ACK_APPLICATION_TYPE_UNRECOGNISEDMSH-16 holds a value outside HL7 Table 0155; it is read as its default
MLLP_ACK_TWO_PHASE_UNAVAILABLEan enhanced-mode send is made on a FIFO client, so the first acknowledgment matched settles it
MLLP_ACK_COMMIT_ALREADY_REPORTEDa further CA arrives for a send whose commit was already reported; the send stays pending
MLLP_ACK_MSA1_ABSENTan acknowledgment for an enhanced-mode send has no MSA-1; the send stays pending
MLLP_ACK_MSA1_UNCLASSIFIABLEan acknowledgment for an enhanced-mode send has an MSA-1 outside HL7 Table 0008; the send stays pending
MLLP_ACK_SEND_ALREADY_DISPOSEDan acknowledgment arrives for a send already settled or failed; it is dropped

ack-from-hl7 warnings​

Carried in the warnings of an MllpAck built by the @cosyte/mllp/ack-from-hl7 subpath.

CodeRaised when
MLLP_ACK_INBOUND_UNPARSEABLEthe inbound could not be parsed, or is an FHS/BHS batch; the acknowledgment is a non-positive AE with no correlation ID
MLLP_ACK_CONTROL_ID_NOT_VERBATIMon a Buffer inbound, the MSA-2 written differs from the inbound MSH-10 bytes
MLLP_ACK_CONTROL_ID_UNVERIFIABLEon a string or parsed inbound, the control ID holds a character outside ASCII, so the echo cannot be checked byte for byte
ACK_NO_CORRELATION_IDfrom @cosyte/hl7: the inbound has no MSH-10, so a requested positive code was downgraded

TLS and bind codes​

Security warnings are emitted on the client's or the server's securityWarning event as a SecurityWarning, and through process.emitWarning:

CodeRaised when
MLLP_TLS_VERIFY_DISABLEDa client configured with tls.allowUnverified completes a handshake, on every connect
MLLP_BIND_ALL_INTERFACESa server created with allowWildcardBind: true binds a wildcard host

TLS configuration errors reject connect() or listen() with an MllpTlsConfigurationError before any socket exists:

CodeRaised when
MLLP_TLS_CIPHER_LIST_REJECTEDthe TLS library accepts no suite in the ciphers list; there is no fallback to its default list
MLLP_TLS_CIPHER_OPTION_CONFLICTboth atnaTransportSecurity and ciphers are set
MLLP_TLS_DH_PARAMETERS_REJECTEDthe server's dhParameters cannot be used

Server connection codes​

Emitted on the server's connectionRejected event as a ConnectionRejectedEvent, only when maxConnections is set:

CodeRaised when
MLLP_CONNECTION_LIMIT_REACHEDa connection arrives while the server holds maxConnections; it is closed at accept

Connection causes​

The connectionCause of an MllpConnectionError, of type ConnectionErrorCause. An error without one is a plain socket failure, such as ECONNREFUSED.

CauseMeaningReconnect
in-flight-orphana FIFO client lost the link with this send already written; it may have been committedthe link, not the send
fifo-unsafea FIFO client lost the link with this send still queued; it was never writtenthe link, not the send
tls-verifycertificate verification failed on the initial connect()no: permanent
tls-handshakethe TLS handshake failed for a protocol reason on the initial connect()no: permanent
framing-fatalthe peer sent bytes the decoder could not accept, or a frame past the size capno: permanent

isTransientConnectionError(err) gives the same classification the client's reconnect uses, and Connection, reconnect and backpressure has the full table.

Negative acknowledgment reasons​

The reason of the server's nack event, a NackEvent, of type NackReason:

ReasonThe server answered negatively because
handler-rejectedyour commit-gated onMessage handler threw or rejected
uncorrelatable-inboundthe inbound had no readable MSH, an empty MSH-10, or more than one message (a batch, or two MSH)
discarded-bytesthe decoder discarded part of the frame (MLLP_TRAILING_BYTES)

Error types​

Narrow with instanceof, never on the text of a message.

ErrorReaches you whenStable field
MllpFramingErrora FrameReader meets a fatal framing violation, or encodeFrame a payload it cannot framecode, byteOffset
MllpConnectionErrora socket-level failure, a send before the client is connected, or a refused bindphase, connectionCause
MllpTimeoutErrorno acknowledgment arrives within ackTimeoutMs of the writemessageControlIdBytes
MllpBackpressureErrora send would pass highWaterMark with onBackpressure: "reject"queueDepth, queueBytes
MllpCommitRejectedErrorthe peer answers an enhanced-mode send with CE or CRcommitCode
MllpApplicationAckErrorthe peer committed an enhanced-mode send and its application acknowledgment never camecommitCode, reason
MllpNeverDeliveredErrorclose() ends with this send never written; resending it is safebyteCount
MllpUnknownFateErrorclose() ends with this send written and unacknowledged; it may be committedflushedAt, byteCount
MllpTlsConfigurationErrora TLS configuration is refused before any socket existscode
MllpDifferentialConfigurationErrorrunDifferential is given a peer address that is not host:port (code MLLP_DIFF_PEER_UNPARSEABLE)code
MllpPeerMissingErrorack-from-hl7 is called without @cosyte/hl7 installed (code MLLP_PEER_MISSING)code
MllpAckErrornot thrown by the package: you throw it from a handler to choose AR over AEackCode

buildMllpAck and its siblings also throw a TypeError for an encoding that is not a text codec, and for a code outside HL7 Table 0008.