# BR-DE-22: Attachment file names not unique

Source: https://veriport.io/einvoice-rules/br-de-22 (published 2026-11-17)

All attachments embedded in the invoice (`cbc:EmbeddedDocumentBinaryObject` / `ram:AttachmentBinaryObject`) must have distinct `filename` attributes, so the receiver can store them without overwriting one with another. Below: the message, the cause and the fix, and an invoice our validator checked, failing and fixed.

- **Specification:** [XRechnung 3.0 rules](/einvoice-rules/xrechnung), XRechnung 3.0.2 schematron 2.6.0
- **Severity:** error
- **Reported by** `POST /einvoice/validate` and our free validators, with a link to this page

## The message validators print

BR-DE-22 is a rule of the XRechnung 3.0 rules (xrechnung-schematron 2.6.0 (XRechnung 3.0.2)) for UBL and CII. It is an error (fatal): a validator rejects the invoice.

```text
[BR-DE-22] Das "filename"-Attribut aller "EmbeddedDocumentBinaryObject"-Elemente muss eindeutig sein
```

```text
[BR-DE-22] Not all filename attributes of the embeddedDocumentBinaryObject elements are unique
```

## What it checks

All attachments embedded in the invoice (`cbc:EmbeddedDocumentBinaryObject` / `ram:AttachmentBinaryObject`) must have distinct `filename` attributes, so the receiver can store them without overwriting one with another.

## Why invoices fail it

Several attachments are generated with the same name (« attachment.pdf », « Anlage.pdf »).

## How to fix it

Give each attachment its own file name, for example with a running number or the document reference.

## A failing invoice and its fix, checked

We start from our sample invoice (two lines at 19 %, Berlin to Stuttgart), written by our own generator as XRechnung 3.0 in UBL. The change below (`-` the failing version, `+` the fixed one) makes the rule fail. Both versions went through our validator on 2026-11-17 (the XML schema and the official rule files, as `POST /einvoice/validate` runs them): the fixed one is valid, the failing one reports BR-DE-22.

| Rule | Severity | Where | Message |
|---|---|---|---|
| **BR-DE-22** | error | `/ubl:Invoice` | Das "filename"-Attribut aller "EmbeddedDocumentBinaryObject"-Elemente muss eindeutig sein |

```diff
  …
      <cbc:DocumentDescription>Stundennachweis</cbc:DocumentDescription>
      <cac:Attachment>
-       <cbc:EmbeddedDocumentBinaryObject mimeCode="text/csv" filename="stunden-2026-10.csv">RGF0dW07U3R1bmRlbgoyMDI2LTEwLTAxOzgK</cbc:EmbeddedDocumentBinaryObject>
+       <cbc:EmbeddedDocumentBinaryObject mimeCode="text/csv" filename="stunden-2026-09.csv">RGF0dW07U3R1bmRlbgoyMDI2LTEwLTAxOzgK</cbc:EmbeddedDocumentBinaryObject>
      </cac:Attachment>
    </cac:AdditionalDocumentReference>
  …
```

## The rule as published

Where the rule applies (`context`) and what must hold (`test`), unmodified from XRechnung 3.0.2 schematron 2.6.0. An `assert` fails when its test is false.

Text and test: © KoSIT, Apache License 2.0. Quoted unmodified; the explanations on this page are Veriport’s.

```xpath
context: /ubl:Invoice | /cn:CreditNote
test:    count(cac:AdditionalDocumentReference) = count(cac:AdditionalDocumentReference[not(./cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename = preceding-sibling::cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename)])
```

```xpath
context: /rsm:CrossIndustryInvoice
test:    count(//ram:AdditionalReferencedDocument) = count(//ram:AdditionalReferencedDocument[not(./ram:AttachmentBinaryObject/@filename = preceding-sibling::ram:AdditionalReferencedDocument/ram:AttachmentBinaryObject/@filename)])
```

## Check your own invoice

Drop your XRechnung, ZUGFeRD or Peppol file into a free validator ([Peppol BIS](/tools/peppol-validator), [XRechnung](/tools/xrechnung-pruefen), [Factur-X](/tools/valider-factur-x)): each runs the same rule files and links every finding to its rule page. From your own code, `POST /einvoice/validate` ([reference](/docs/einvoice)) returns the same check as JSON, each finding with an `explanation` field pointing here (5 calls a check, anonymous within the daily allowance).

## Read next

- [BR-DE-20: Debited IBAN (BT-91) invalid for code 59](https://veriport.io/einvoice-rules/br-de-20)
- [BR-DE-21: Specification identifier not XRechnung’s](https://veriport.io/einvoice-rules/br-de-21)
- [BR-DE-23-a: Credit transfer group (BG-17) for codes 30, 58](https://veriport.io/einvoice-rules/br-de-23-a)
- [BR-DE-23-b: Card or direct debit data with a transfer code](https://veriport.io/einvoice-rules/br-de-23-b)
- [All XRechnung 3.0 rules](https://veriport.io/einvoice-rules/xrechnung)
- [All e-invoice rules, search](https://veriport.io/einvoice-rules)
- [Check an e-invoice free (XRechnung prüfen)](https://veriport.io/tools/xrechnung-pruefen)
- [Create a valid e-invoice free (German form)](https://veriport.io/tools/e-rechnung-erstellen)

## Sources

- XRechnung — the German CIUS of EN 16931 (standard, versions and bundles; version 3.0.2 in force) — https://xeinkauf.de/xrechnung/ (2026-10-28)
- Validator configuration XRechnung v2026-08-31 (XRechnung 3.0.2, CEN schematron 1.3.16, xrechnung-schematron 2.6.0) — https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/tag/v2026-08-31 (2026-10-28)
- XRechnung schematron (xrechnung-schematron) and the XRechnung validator configuration: licence, Apache License 2.0 (LICENSE files; NOTICE of the configuration: « Copyright 2020 Koordinierungsstelle für IT-Standards ») — https://github.com/itplr-kosit/xrechnung-schematron/blob/master/LICENSE (2026-11-17)
