Invoice has an out-of-scope VAT breakdown but a line in another category
Reported asline_not_out_of_scopea line in a category other than out of scope
What is wrong
A cac:TaxSubtotal directly under the invoice's own cac:TaxTotal is coded O - out of scope - under the VAT tax scheme, and at least one invoice line's cac:Item/cac:ClassifiedTaxCategory is in a different category. EN 16931 rule BR-O-12, which ZATCA runs, requires every line on such an invoice to be out of scope. The two halves read different things: the trigger is the breakdown directly under the document root, while the lines are counted anywhere in the document. A line whose classified tax category has no cbc:ID at all counts as a different category, because an absent code is read as an empty one.
What to check in your ERP
Either a line has the wrong category or the breakdown does. Compare the category letter on every line against the breakdown, and expect the mismatch to come from a single item whose tax code differs from the rest - freight, a service charge or a rounding line are the usual ones, since they often take a default tax code rather than the one on the goods. If the invoice genuinely covers both out-of-scope and other supplies it has to be split into two documents; no configuration makes one document carry both.