Attestwire › Rule reference › ATW-DECLARED-TOTAL-NOT-FINITE
ATW-DECLARED-TOTAL-NOT-FINITE A declared document total must be a finite number
noun · Attestwire · fatal · BT-110
For a sample invoice, the library reports: declaredTotals.taxAmount (BT-110, Invoice total VAT amount) is NaN, which is not a finite number. This is not a rule of the regulation — no invoice can express it, because the XML type behind every monetary amount is xs:decimal and has no NaN or infinity.
- Business term
BT-110- Severity
fatal
The fix
Trace where declaredTotals.taxAmount is computed and guard the inputs — Number.isFinite() on the result before assigning it is usually enough. If you only wanted the library's own totals, drop declaredTotals entirely: generation always emits computed values regardless of what you declare.
A passing value
"declaredTotals": { "taxAmount": 1785.00 }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": "ATW-DECLARED-TOTAL-NOT-FINITE",
"field": "BT-110",
"severity": "fatal",
"message": "declaredTotals.taxAmount (BT-110, Invoice total VAT amount) is NaN, which is not a finite number. This is not a rule of the regulation — no invoice can express it, because the XML type behind every monetary amount is xs:decimal and has no NaN or infinity. It is almost always the residue of an arithmetic slip upstream: dividing by a zero quantity, summing an array containing undefined, or parsing a total out of a string that was not one. Reported as a finding rather than thrown, so you get the rest of the findings for this document at the same time.",
"fix": "Trace where declaredTotals.taxAmount is computed and guard the inputs — Number.isFinite() on the result before assigning it is usually enough. If you only wanted the library's own totals, drop declaredTotals entirely: generation always emits computed values regardless of what you declare.",
"example": "\"declaredTotals\": { \"taxAmount\": 1785.00 }",
"xpath": "/ubl:Invoice/cac:TaxTotal/cbc:TaxAmount",
"docsUrl": "https://github.com/attestwire/en16931#not-implemented-yet"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.