Attestwire › Rule reference › BR-CO-22
BR-CO-22 A document-level charge needs a reason, a reason code, or both
noun · EN 16931 · fatal · BT-104 / BT-105
For a sample invoice, the library reports: Taken individually, the reason (BT-104) and the reason code (BT-105) on the document level charge at charges[0] are both optional terms — which is why this constraint exists separately from BR-38: it is the co-occurrence rule that forbids the one combination the cardinalities allow, namely neither.
- Business term
BT-104 / BT-105- Severity
fatal
The fix
Add charges[0].reason, charges[0].reasonCode, or both. If no UNCL 7161 code fits what you are charging for, omit the code and write the reason as free text — the list has no "other" entry, and inventing a code fails BR-CL-20.
A passing value
"reason": "Freight service", "reasonCode": "FC"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-22",
"field": [
"BT-104",
"BT-105"
],
"severity": "fatal",
"message": "Taken individually, the reason (BT-104) and the reason code (BT-105) on the document level charge at charges[0] are both optional terms — which is why this constraint exists separately from BR-38: it is the co-occurrence rule that forbids the one combination the cardinalities allow, namely neither. Supplying both is explicitly permitted and is usually the better answer, since the code is what a receiving system can act on automatically and the text is what a person reads.",
"fix": "Add charges[0].reason, charges[0].reasonCode, or both. If no UNCL 7161 code fits what you are charging for, omit the code and write the reason as free text — the list has no \"other\" entry, and inventing a code fails BR-CL-20.",
"example": "\"reason\": \"Freight service\", \"reasonCode\": \"FC\"",
"xpath": "/ubl:Invoice/cac:AllowanceCharge[1]/cbc:AllowanceChargeReasonCode",
"docsUrl": "https://attestwire.com/rules/BR-CO-22"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.