Previous invoice hash is longer than 255 characters
Reported aslonger_than_255longer than 255 characters
What is wrong
The previous invoice hash field (KSA-13) - the text content of cbc:EmbeddedDocumentBinaryObject inside the cac:AdditionalDocumentReference whose id is PIH - is more than 255 characters long, and ZATCA refuses the document under BR-CL-KSA-13. Two things about this rule will otherwise waste your time. The checker enforces 255, but the message it prints says something different: field character limit for previous invoice hash field has been exceeded, the maximum limit for this field is 64. The number that decides whether the document is accepted is 255, and 64 is wrong in ZATCA's own message text - so a value of 80 characters is accepted even though the message would lead you to expect otherwise. And the label printed inside that message is KSA-13, while the code the checker outputs, and the one to search its output for, is BR-CL-KSA-13. A correct hash is nowhere near this ceiling: 44 characters, or 88 in the other form ZATCA's standard publishes. So this rule does not fire on a hash that is merely wrong - it fires on a value that is not a hash at all. The length is measured on the value exactly as written, so whitespace inside it counts toward the 255.
What to check in your ERP
A value this long is almost always something other than a digest. The cases that produce it are a whole certificate or signature block written into the field, base64 of an entire file or of the previous invoice's XML rather than of its digest, a concatenation of every prior hash in the chain instead of just the last one, and an error message or stack trace written through by a step that failed silently. Check what the field is being given rather than trimming it, because truncating to 255 would leave a value that passes this rule and is still not a hash. Also check whether your XML writer wraps long base64 across indented lines: those line breaks and leading spaces are characters in the element's text and count toward the limit.