FatturaPA (Italy / SdI)
00312
CodiceDestinatario non coerente con FormatoTrasmissione
What it means
The length of CodiceDestinatario does not match FormatoTrasmissione: FPA12 (PA) requires 6 characters, FPR12 (private) requires 7.
How to fix it
If FormatoTrasmissione is FPR12 use a 7-character code (or 0000000 with a PEC); if FPA12 use the 6-character IPA office code.
Catch this before it reaches the SdI:
# CLI
npx @eleata/validate-einvoice validate invoice.xml --format fatturapa
# GitHub Action — fail the build on any invalid invoice
- uses: hernaninverso/validate-einvoice-action@v1
with:
files: invoices/**/*.xml
api-key: ${{ secrets.EINVOICE_API_KEY }}