BR-KSA-34Invoice counter value contains something other than digits

Mutabiq checks Saudi ZATCA Phase 2 e-invoice XML before you submit it: pre-validation against published ZATCA requirements, not an approval by the authority. This page explains one rule, BR-KSA-34.

Validate 5 invoices free

Five checks a month on the Free plan. The file is checked in memory and is never stored.

The message ZATCA prints

[BR-KSA-34]-The invoice counter value (KSA-16) contains only digits.

What Mutabiq reports

One entry for each way this rule can be reported.

Reported as
What kind of value was found — empty, not_15_digits and the like — never the value itself.

Invoice counter value contains something other than digits

Reported asnot_digitscontains something other than digits

What is wrong

The invoice counter value (KSA-16), carried in the cbc:UUID of the ICV document reference, contains a character that is not a digit. ZATCA refuses the document under BR-KSA-34, whose message reads: the invoice counter value (KSA-16) contains only digits. Only the characters 0 to 9 are allowed - no letters, no hyphens, no spaces, no thousands separators and no prefix. Two things about the check are worth knowing. A counter that is absent or empty is not reported here: the test is a regular expression that allows an empty value, and a missing value is read as an empty one, so it passes. Presence is a different rule, BR-KSA-33, and appears in this report as the finding titled Invoice counter value is missing. And the path ZATCA evaluates is not restricted to the ICV reference - it reads whichever cac:AdditionalDocumentReference carries a cbc:UUID. On a ZATCA invoice the ICV reference is the only one that does, so the two readings coincide; on a document where some other reference carries one, that is the value judged. One further limit, stated so it is not assumed: BR-KSA-34's published wording also asks that the counter be greater than the previous invoice's. That half is not checked here and cannot be, because a pre-validator sees one document and never the one before it, so a counter that is all digits but repeats or runs backwards passes this check and can still be refused once the authority sees the sequence.

What to check in your ERP

The counter is a plain decimal integer and nothing else: 1, 2, 3 and upward, written with no formatting around it. The element name is misleading and is the commonest cause of this finding - cbc:UUID holds the counter, not a GUID, and a mapping written from the element name rather than from the field definition will put a UUID there. The other usual causes are the invoice number written into the counter, which normally carries a prefix and dashes; a branch or device code prefixed to keep counters apart across sites, which the counter does not need because each device keeps its own series; a thousands separator applied by a report formatter; a leading apostrophe picked up from a spreadsheet export; and whitespace, including an XML writer set to pretty-print, which puts the value on its own indented line. The counter is not the invoice number (BT-1) and does not reset per customer, per branch or per year - it increments by one for every document the issuing device or system emits, credit and debit notes included.

The clause that runs

Quoted from the validation-rule stylesheet ZATCA publishes, at the file and line named below. The executed guard is what the check runs; the reported test is what it prints when it fails, and the two are not always the same.

Executed guard

not(matches(cac:AdditionalDocumentReference/cbc:UUID, '^[0-9]*$'))

Reported test

matches(cac:AdditionalDocumentReference/cbc:UUID, '^[0-9]*$')
Evaluated against
/ubl:Invoice | /cn:CreditNote
Source
vendor/zatca/schematron/20210819_ZATCA_E-invoice_Validation_Rules.xsl:424

As shipped in ZATCA SDK 3.4.8: the copy quoted here is, byte for byte, the file that release ships. The date in the file name is the name ZATCA gives the file; the rules in it are those of SDK 3.4.8.

A worked example

A synthetic document from the measured test corpus that trips this rule, shown where it differs from one that passed. Mutabiq's report names the class of the value, never the value itself.

Where it differs from a document that passed

  • This example
  • A document that passed
<cac:AdditionalDocumentReference>  <cbc:ID>ICV</cbc:ID>This example:   <cbc:UUID>INV-0001</cbc:UUID>A document that passed:   <cbc:UUID>1</cbc:UUID></cac:AdditionalDocumentReference><cac:AdditionalDocumentReference>
Document
bad-40-icv-not-digits.xml
Mutabiq's verdict
Not passed
Reported as
not_digitscontains something other than digits

Download this example (.xml)Check it in Mutabiq

This page's example, checked by the same rules your own upload goes through. No upload and no sign-in.

Rules evaluated against the same part of the document. One wrong value often reports several of them at once.

Check an invoice

Check your own invoice

© 2026 Hayatiq AI Solutions F.Z.E. All rights reserved.