# BR-DE-22 Embedded document filenames must be unique across all attachments

Under the German XRechnung profile rule BR-DE-22, an invoice must not contain embedded document attachments with identical filenames (BT-125 / filename attribute). When multiple additional supporting documents (BG-24 / AdditionalDocumentReference) with binary attachments (cac:Attachment/cbc:EmbeddedDocumentBinaryObject or ram:AttachmentBinaryObject) are included, each attached file must have a distinct, unique filename. Duplicate filenames cause document management systems to overwrite or fail extraction of required invoice evidence such as timesheets, performance protocols, or contract annexes.

## Problem Description

Under the German XRechnung profile rule BR-DE-22, an invoice must not contain embedded document attachments with identical filenames (BT-125 / filename attribute). When multiple additional supporting documents (BG-24 / AdditionalDocumentReference) with binary attachments (cac:Attachment/cbc:EmbeddedDocumentBinaryObject or ram:AttachmentBinaryObject) are included, each attached file must have a distinct, unique filename. Duplicate filenames cause document management systems to overwrite or fail extraction of required invoice evidence such as timesheets, performance protocols, or contract annexes.

> **ERROR**: XRechnung 3.0

## Context and Significance

The German XRechnung validator strictly inspects all embedded attachment filenames for duplicate values, triggering Schematron error BR-DE-22 if two or more attachments share the same filename.

## Solution

In your ERP or document management system, ensure that all attached files have distinct filenames before exporting the XRechnung XML. In UBL 2.1 syntax, populate distinct filename attributes on <cbc:EmbeddedDocumentBinaryObject filename="timesheet_2026_01.pdf" mimeCode="application/pdf"> inside each <cac:AdditionalDocumentReference>. In UN/CEFACT CII syntax, populate distinct filename attributes on <ram:AttachmentBinaryObject filename="timesheet_2026_01.pdf" mimeCode="application/pdf"> under <ram:AdditionalReferencedDocument>. Rename duplicate attachments (e.g. "annex_1.pdf", "annex_2.pdf") prior to submission.

- validate
- convert

## Valid Examples

- Invoice with two attachments: "stundennachweis_januar.pdf" and "leistungsabnahme_januar.pdf"
- Invoice with single attachment: "vertrag_anlage_1.pdf"

## Invalid Examples

- Invoice includes two attachments both named "anlage.pdf"
- cac:AdditionalDocumentReference contains multiple binary objects with identical filename attributes

## Code Examples

### Valid XML
```
<cac:AdditionalDocumentReference>
  <cbc:ID>DOC-1</cbc:ID>
  <cac:Attachment>
    <cbc:EmbeddedDocumentBinaryObject filename="stundennachweis.pdf" mimeCode="application/pdf">UEsDBBQ...</cbc:EmbeddedDocumentBinaryObject>
  </cac:Attachment>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference>
  <cbc:ID>DOC-2</cbc:ID>
  <cac:Attachment>
    <cbc:EmbeddedDocumentBinaryObject filename="leistungsnachweis.pdf" mimeCode="application/pdf">UEsDBBQ...</cbc:EmbeddedDocumentBinaryObject>
  </cac:Attachment>
</cac:AdditionalDocumentReference>
```

### Invalid XML
```
<cac:AdditionalDocumentReference>
  <cbc:ID>DOC-1</cbc:ID>
  <cac:Attachment>
    <cbc:EmbeddedDocumentBinaryObject filename="anhang.pdf" mimeCode="application/pdf">UEsDBBQ...</cbc:EmbeddedDocumentBinaryObject>
  </cac:Attachment>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference>
  <cbc:ID>DOC-2</cbc:ID>
  <cac:Attachment>
    <!-- Duplicate filename triggers BR-DE-22 -->
    <cbc:EmbeddedDocumentBinaryObject filename="anhang.pdf" mimeCode="application/pdf">UEsDBBQ...</cbc:EmbeddedDocumentBinaryObject>
  </cac:Attachment>
</cac:AdditionalDocumentReference>
```

## Affected Fields

- [BT-125 Attached document](/resources/xrechnung/bt-125-attached-document)
- [BG-24 Additional supporting documents](/resources/xrechnung)
- [BT-122 Supporting document reference](/resources/xrechnung/bt-122-supporting-document-reference)

## Related Rules

- [BR-DE-23](#)
- [BR-52](/resources/kosit-validator-errors/br-52-supporting-document-reference-required)

## Validation Tools

- [Official KoSIT Validator](https://erechnungsvalidator.service-bw.de/): Validate your XRechnung files against all BR-DE rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Automatic validation error fixes when converting.

## Related Resources

- [Official Specification](https://xeinkauf.de/xrechnung/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [Complete Error List](/resources/kosit-validator-errors): Overview of all German XRechnung validation rules.
