Attestwire › Rule reference › BR-CO-24
BR-CO-24 A line charge needs a reason, a reason code, or both
noun · EN 16931 · fatal · BT-144 / BT-145
For a sample invoice, the library reports: The reason (BT-144) and the reason code (BT-145) on the invoice line charge at lines[0].charges[0] are individually optional terms, and this constraint — separate from BR-44, which is the cardinality rule on the group — is what rules out the one combination those cardinalities would otherwise permit: neither present.
- Business term
BT-144 / BT-145- Severity
fatal
The fix
Add lines[0].charges[0].reason, lines[0].charges[0].reasonCode, or both. Where no UNCL 7161 code describes what you are charging for, omit the code entirely and use free text — the lists have no "other" entry, and an invented code fails BR-CL-20.
A passing value
"reason": "Handling", "reasonCode": "SH"What the library returns
The full error returned by @attestwire/en16931. It includes the rule ID,
affected field and suggested correction. Developers can use this object in their application:
{
"rule": "BR-CO-24",
"field": [
"BT-144",
"BT-145"
],
"severity": "fatal",
"message": "The reason (BT-144) and the reason code (BT-145) on the invoice line charge at lines[0].charges[0] are individually optional terms, and this constraint — separate from BR-44, which is the cardinality rule on the group — is what rules out the one combination those cardinalities would otherwise permit: neither present. Supplying both is allowed and preferable, because the code is machine-actionable and the text is what a person reads.",
"fix": "Add lines[0].charges[0].reason, lines[0].charges[0].reasonCode, or both. Where no UNCL 7161 code describes what you are charging for, omit the code entirely and use free text — the lists have no \"other\" entry, and an invented code fails BR-CL-20.",
"example": "\"reason\": \"Handling\", \"reasonCode\": \"SH\"",
"xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cac:AllowanceCharge[2]/cbc:AllowanceChargeReasonCode",
"docsUrl": "https://attestwire.com/rules/BR-CO-24"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.