# Programmatic Handling of E-Invoice Schema Errors

- 2026-08-29

Parse validation errors, find structural XML and namespace issues, and apply only source-backed corrections.

## Parsing the validation payload

When an invoice fails schema validation, the API returns structured JSON errors instead of converted XML. Map known error codes to fields, but change a value only when approved source or master data supports it. Route ambiguous or material changes to a human reviewer.

The error response contains a VALIDATION_FAILED status code along with an array of error objects. Each object provides a specific path to the failing field, the value that caused the error, and a human-readable description of the compliance rule that was violated (e.g., BR-CO-13).

## Automating common resolutions

- For a missing BuyerReference, use the value for this order from approved customer or order data. If it is unavailable, ask the buyer; do not insert a default Leitweg-ID.
- For rounding mismatches (e.g. PayableAmount differences), review the source document and correct the underlying line amounts or VAT figures; only accept values that match the invoice.
- For a missing unit code, Invoice Converter defaults the line to C62 and flags it for review; confirm the flagged unit matches the source invoice before accepting.

## Retry vs. manual escalation

- Retry automatically only after a transient connection or rate-limit error, or after a deterministic correction confirmed by source data.
- Manual Review: Required when totals are significantly different, bank details are missing, or tax categories are ambiguous.
