docs← Back to article

Markdown for LLMs

LDC-E8301 — Overlapping rows under hit unique

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# LDC-E8301 — Overlapping rows under hit unique

## What it means

A decision table with a unique hit policy promises that at most one
row fires for any input: the rows must be pairwise disjoint. When two
rows can both match the same input, the promise is broken — the engine
could not pick a single winner — so the compiler stops at the later
row and names both rows involved.

Narrowing one of the guards until the two rows exclude each other is
the fix. If overlapping rows are intended, a different hit policy that
allows several rows to fire says so explicitly.

## Example

```law
language "law.core" version "0.2";
package demo.diag version "0.1.0";
namespace "urn:law:demo:diag";

decision Bad(x: Integer) -> Integer {
  table hit unique { when x >= 0 => 1; when x >= 0 => 2; otherwise => 0; }
}
```

## Fix

```law
language "law.core" version "0.2";
package demo.diag version "0.1.0";
namespace "urn:law:demo:diag";

decision Good(x: Integer) -> Integer {
  table hit unique { when x < 10 => 1; when x >= 10 => 2; otherwise => 0; }
}
```

## Engine message

The engine reports this in its own wording:

```text
example.law:6:40: error LDC-E8301: decision "Bad": TABLE_OVERLAP between rows sha256:672c5325b6d7f7a721c9583945d1eca868ea3d2ffe288d2e4bf646227837365a and sha256:7e210bd11ae60986de842d6a4f28b753d46b7cce012b75f74407f2c4d244d2d4 under hit unique
```

## Related

- [LDC-E8302](/diagnostics/LDC-E8302/) — hit policies and row guards.