# BR-21 Invoice line identifier is required

Each Invoice line (BG-25) shall have an Invoice line identifier (BT-126) that is unique within the invoice.

## Problem Description

Each Invoice line (BG-25) shall have an Invoice line identifier (BT-126) that is unique within the invoice.

> **ERROR**: XRechnung 3.0

## Context and Significance

This is a core EN16931 rule; the line identifier lets references and corrections address a specific line, so every line must have one.

## Solution

Give every cac:InvoiceLine a cbc:ID value, for example 1, 2, 3, ensuring no line is left without an identifier.

- validate
- convert

## Valid Examples

- BT-126 = 1 on the first line, BT-126 = 2 on the second line

## Invalid Examples

- A cac:InvoiceLine element without any cbc:ID child

## Code Examples

### Valid XML
```
<cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
</cac:InvoiceLine>
```

### Invalid XML
```
<cac:InvoiceLine>
  <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
</cac:InvoiceLine>
```

## Affected Fields

- [BT-126 Invoice line identifier](/resources/xrechnung/bt-126-invoice-line-identifier)

## Related Rules

- [BR-16](/resources/kosit-validator-errors/br-16-at-least-one-invoice-line-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.
