# LDC-E2119 — An empty-collection fallback of the wrong kind ## What it means An aggregate over a collection declares its element kind, and the empty-collection fallback must be of that same kind: the fallback becomes the aggregate value when the collection is empty, so a money collection needs a money fallback, not an integer. The usual scalar-widening rule does not apply here — the fallback is the aggregate's own value, not an arithmetic operand. Rewriting the fallback in the element kind clears it. The message names both kinds found, which shows which side to adjust. ## Example ```law language "law.core" version "0.2"; package demo.diagnostics version "0.1.0"; namespace "urn:law:demo:diagnostics"; entity Order; relation amount(x: Order, a: Money) kind empirical; relation total(x: Order, a: Money) kind institutional; rule R strict { for o: Order; for t: Money; when amount(o, t); then total(o, sum(collect all a: Money, x: Order where amount(x, a), empty: 0)); } ``` ## Fix ```law language "law.core" version "0.2"; package demo.diagnostics version "0.1.0"; namespace "urn:law:demo:diagnostics"; entity Order; relation amount(x: Order, a: Money) kind empirical; relation total(x: Order, a: Money) kind institutional; rule R strict { for o: Order; for t: Money; when amount(o, t); then total(o, sum(collect all a: Money, x: Order where amount(x, a), empty: 0 KZT)); } ``` ## Engine message The engine reports this in its own wording: ```text example.law:11:79: error LDC-E2119: sum: empty-collection policy kind Integer does not match its element kind Money (§59). The §49 scalar rule does not apply here: the policy is not an arithmetic operand but the aggregate's OWN VALUE — before errata E-0195 such an entry silently changed the answer kind ``` ## Related - [Expressions and quantities](/constructs/expressions-quantities/) — how aggregate calls are written.