Skip to content

Ironfang Finance - Rule reference

UBL-CR-666: Remove Attachment from the invoiced object reference

Fatal: EN 16931 does not allow cac:Attachment in the invoiced object reference. The document is invalid until you remove it.

EN 16931Fatal: the document is invalidProcess and references

On this page

The short answer

UBL-CR-666 is a fatal rule raised when the invoiced object reference, a cac:AdditionalDocumentReference with cbc:DocumentTypeCode 130, has a cac:Attachment. Only supporting documents (BG-24) carry attachments, so remove it here.

The document is invalid while the element is there: the EN 16931 layer fails with this rule, and a receiver can refuse the document.

What the rule checks

The rule looks at every cac:AdditionalDocumentReference with cbc:DocumentTypeCode 130, the invoiced object identifier (BT-18), and checks whether it has a cac:Attachment. Supporting documents (BG-24), without code 130, may carry one.

It runs once against the whole document, so it is reported once however many times the document has the element, and the finding points at the document root rather than at the element: look for cac:AdditionalDocumentReference/cac:Attachment in the XML.

Everything inside cac:Attachment goes with it. Elements inside it have warnings of their own, UBL-CR-121, UBL-CR-122, UBL-CR-123, UBL-CR-124, UBL-CR-125, UBL-CR-126, UBL-CR-127, UBL-CR-128, UBL-CR-129 and UBL-CR-130; removing cac:Attachment clears those too.

TermMeaningUBL element
-Attachment (BT-125 on a supporting document, not on the invoiced object)cac:AdditionalDocumentReference/cac:Attachment
BT-18Invoiced object referencecac:AdditionalDocumentReference

How an integration ends up here

Possible causes, from the shape of the rule rather than from measured usage:

  • A whole cac:Attachment structure is copied from a master record or another document type, including parts EN 16931 does not use.
  • A general UBL 2.1 library writes every element and attribute it has a value for, whether or not EN 16931 uses it.
  • A mapping built for another UBL-based document, such as an order, a despatch advice or a national profile, is reused for Peppol BIS Billing.

How to fix it

  1. Remove cac:Attachment from the reference with cbc:DocumentTypeCode 130.
  2. Send the file as a supporting document instead: a separate cac:AdditionalDocumentReference without code 130, with its own cbc:ID and the cac:Attachment (BG-24).
  3. Validate again: the document is valid once it is gone.

Validate your corrected invoice

Before and after

These are fragments, not complete documents. The complete synthetic documents they come from are linked below.

Fragment of the invoice with the error: Attachment in the invoiced object reference

<cac:AdditionalDocumentReference>
  <cbc:ID schemeID="AAB">OBJECT-001</cbc:ID>
  <cbc:DocumentTypeCode>130</cbc:DocumentTypeCode>
  <cac:Attachment>
    <cac:ExternalReference>
      <cbc:URI>https://example.invalid/object-001.pdf</cbc:URI>
    </cac:ExternalReference>
  </cac:Attachment>
</cac:AdditionalDocumentReference>

Fragment of the corrected invoice: the same lines without it

<cac:AdditionalDocumentReference>
  <cbc:ID schemeID="AAB">OBJECT-001</cbc:ID>
  <cbc:DocumentTypeCode>130</cbc:DocumentTypeCode>
</cac:AdditionalDocumentReference>

The invoice with the error has <cac:Attachment> in the invoiced object reference, and the corrected invoice is the same document without it. It fails the EN 16931 layer with this rule alone, and every other layer passes.

What the validator reported

Recorded on phive 12.1.0 / phive-rules-peppol 4.5.6 / Saxon-HE 12.10, the engine behind the free validator, using synthetic data. A recorded result is regression evidence for these documents; it is not a certification.

Where it applies

  • Applies to UBL Invoice and CreditNote alike; the recorded example is an invoice.
  • The error comes from the EN 16931 layer's rules for the UBL syntax. In the recorded example the schema layer passes: the element is valid UBL 2.1 and is only outside the EN 16931 model.

Scope and source

Written for Peppol BIS Billing 3.0.21 (May 2026), EN 16931 1.3.16, as applied to UBL 2.1 Invoice and CreditNote documents. Other profiles, syntaxes and releases can define this identifier differently. Guidance version 2026-09-29.1: source checked 2026-09-29, explanation last updated 2026-09-29.

The official definition of UBL-CR-666 carries the normative wording and test. This page is our explanation of it, not a copy.

Guidance does not change the engine verdict. Fixing this finding does not mean the document passes every layer, and validation does not certify legal or tax compliance or transmit a document over Peppol.