ZATCA rejections almost always trace back to one of three layers: business rules (sequencing, hashing, tax codes), schema validation (malformed XML against the UBL 2.1 KSA profile), or infrastructure (certificate and authentication problems). Fix the root cause in your source system before resubmitting — resending the same broken file just produces the same rejection.
1. The Three Rejection Categories
Every ZATCA validation response falls into one of three buckets, and knowing which one you're dealing with tells you where to actually look for the fix:
| Category | What It Checks | Typical Symptom |
|---|---|---|
| Business Rules (BR) | Sequencing, hashing, tax logic, identity consistency against ZATCA's records | Most common — often the same HTTP error code as schema failures, different root cause |
| XML Schema (XSD) | Whether the XML conforms to UBL 2.1 with the required KSA extensions | Loud and usually easy to pinpoint — a missing or malformed field |
| Infrastructure | Certificate validity, authentication, environment (sandbox vs production) | 401/403-style errors, often unrelated to the invoice content itself |
Schema and business-rule errors can look identical at first glance
Both can surface as the same generic HTTP 400 response from your integration layer. The difference only becomes clear once you read the actual validation message ZATCA returns — which is why the first troubleshooting step is always to pull the full error payload, not just the status code.
2. Business Rule Errors — Sequencing, Hashing & Tax Logic
Business Rule violations are the highest-volume rejection cause once a business moves into Phase 2 integration. These six show up most often:
Invoice Counter Value (ICV) Not Sequential
Previous Invoice Hash (PIH) Mismatch
Invoice Hash Doesn't Match Content
Missing Exemption or Zero-Rate Reason Code
Seller Name Doesn't Match VAT Registration Record
Incorrect Invoice Type Code
3. Schema Validation Errors — Malformed XML
Schema errors happen when your XML doesn't conform to the UBL 2.1 standard with ZATCA's Kingdom-specific extensions layered on top.
Missing KSA UBL Extension Blocks
Missing or Incorrectly Formatted Issue Date/Time
Structured Address Fields Incomplete
4. Infrastructure & Certificate Errors
These errors have nothing to do with the invoice content itself — they're about whether ZATCA can authenticate who's sending it.
401 Unauthorized
Certificate Permissions / VAT Number Mismatch
B2C Reporting Deadline Missed
5. QR Code / TLV Encoding Errors
The QR code on simplified invoices uses TLV (Tag-Length-Value) encoding, and Arabic text is a frequent source of subtle, hard-to-spot failures.
- Incomplete QR payload: One or more of the five required fields (seller name, VAT number, timestamp, invoice total, VAT total) is missing from the encoded data.
- Byte-length miscalculation on Arabic text: TLV length bytes must reflect the actual byte length of UTF-8 encoded Arabic text, not the character count — a frequent source of QR corruption when developers assume 1 character = 1 byte.
- Cryptographic stamp mismatch: The stamp added after ZATCA clearance doesn't match the invoice data, or was generated using an expired certificate.
Test your QR decode, not just your QR generation
A QR code that "looks right" visually can still carry corrupted TLV data. Decode your own generated QR codes with an independent TLV parser as a validation step — don't rely solely on visual inspection or a successful-looking scan.
Exact error code labels vary by system — verify against the live response
Different ERPs, middleware providers, and ZATCA SDK versions can surface slightly different code names and descriptions for the same underlying rule. Treat any specific code number you see in a support forum or vendor guide as a starting point, not gospel — always cross-check the precise validation message in your own live API response against ZATCA's official documentation.
- Three failure layers: business rules, schema validation, and infrastructure/certificates — identify which one before troubleshooting
- ICV and PIH chains must be unbroken — centralize invoice numbering through one authoritative counter per entity
- Never edit a signed invoice — hash mismatches come from post-signature changes; issue a credit note instead
- Separate Compliance and Production certificates — the single most common 401 error is using the wrong CSID environment
- Map exemption/zero-rate reason codes before go-live, not during rejection cleanup
- B2C invoices need reporting within 24 hours — daily batch uploads are a common way to miss this
- Arabic TLV encoding uses byte length, not character count — a frequent silent QR corruption source
- Fix the root cause, then resubmit — resending the same file without a correction reproduces the same rejection
6. Troubleshooting Checklist
Pull the full validation response
Get the actual error message and code from ZATCA's API response, not just the HTTP status — this tells you which of the three categories you're dealing with.
Check sequencing first
If it's a Business Rule error, verify ICV continuity and PIH chain integrity before looking anywhere else — this is the highest-frequency cause.
Validate against the KSA schema, not generic UBL 2.1
Confirm ProfileID and the required AdditionalDocumentReference blocks are present if you're seeing schema failures.
Confirm your certificate environment
Check whether you're using a Compliance or Production CSID, and that it matches the VAT number on the invoice and hasn't expired.
Decode your own QR output
Independently verify TLV encoding, especially for Arabic seller names, rather than trusting visual inspection.
Fix at the source, then regenerate
Correct the underlying data or configuration, regenerate the hash/UUID as needed, and resubmit — don't just retry the original file.
Frequently Asked Questions
Why does ZATCA reject e-invoices most often?
Rejections fall into three categories: Business Rule violations (sequencing, hashing, tax logic), XML schema failures against the UBL 2.1 KSA profile, and infrastructure errors like expired certificates. Business Rule violations are the most frequent during Phase 2 integration.
What causes an ICV or PIH error?
The ICV must increment by exactly 1 per document, and the PIH must match the hash of the immediately preceding invoice. These break during legacy migrations, multi-server issuance without a shared counter, or invoices generated out of order.
Why is my integration returning 401 Unauthorized?
Usually an expired, invalid, or mismatched CSID certificate — including using a Compliance CSID in the Production environment, or a certificate registered to a different VAT number than the one submitting the invoice.
What is the deadline to report B2C simplified invoices?
Within 24 hours of issuance under the Reporting Model. Businesses relying on daily batch uploads rather than near-real-time reporting are the most likely to miss this window.
Do exact ZATCA error code numbers stay consistent across systems?
Not entirely — code labels can vary by ERP, middleware, or SDK version. Treat third-party code references as a general guide and confirm the precise rule against ZATCA's own documentation and your live API response.
Can a rejected invoice be corrected and resubmitted?
Yes — fix the underlying issue at the source, regenerate the hash and UUID where needed, and resubmit. Resending the same rejected file unchanged will typically produce the same rejection.