ATW-DECLARED-TOTAL-NOT-FINITE declaredTotals.taxAmount (BT-110, Invoice total VAT amount) is NaN, which is not a finite number
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.
This rule is implemented and its error payload below is real, but the long-form write-up — normative text, worked example, divergence note — is not written yet. Everything the library knows about this rule is on this page. Ask and we will prioritise it.
- Business term
BT-110- Severity
fatal
What the library returns
The exact object in result.errors when this rule fires.
Generated by running @attestwire/en16931, not transcribed:
{
"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 locates the element in the generated UBL document,
which is where a KoSIT or Peppol validator will report the same problem.
A passing value
"declaredTotals": { "taxAmount": 1785.00 }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.