BR-CL-KSA-14: The QR code value must be 1 to 1000 characters long

Explained by Matheel from ZATCA's rule text and the condition SDK 3.4.8 executes · Updated

Error: the invoice is rejectedConditional, see belowFields: KSA-14

Applies only when the QR element exists: the content of cac:AdditionalDocumentReference with cbc:ID = 'QR' / cac:Attachment / cbc:EmbeddedDocumentBinaryObject must be at least 1 and at most 1000 characters. (The rule's test text is written as the failure condition: it fires when the length is over 1000 or under 1.)

How to fix it

Keep the Base64 QR value in cbc:EmbeddedDocumentBinaryObject non-empty and no longer than 1000 characters.

ZATCA's official text

[KSA-14]Field character limit for QR Code field has been exceeded. The maximum character limit for this field is 1000 characters.
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

exists(cac:AdditionalDocumentReference[normalize-space(cbc:ID) = 'QR']/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) and (string-length(cac:AdditionalDocumentReference[normalize-space(cbc:ID) = 'QR']/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) > 1000 or string-length(cac:AdditionalDocumentReference[normalize-space(cbc:ID) = 'QR']/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) < 1)

Related rules

Validate your invoice against ZATCA's rules

Paste the XML and see every error and warning. It runs in your browser; the invoice goes nowhere.

Validate an invoice or try Matheel