docs← Back to article

Markdown for LLMs

LDC-E2116 — Wrong argument count for a standard function

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

Download this articlePlain text ↗
# LDC-E2116 — Wrong argument count for a standard function

## What it means

Standard functions declare their arity just like file relations do:
each name takes a fixed number of arguments, set by its own meaning.
An extra argument or a missing one is rejected at the call — the
compiler never guesses what the surplus was for or invents the absent
piece.

Removing the extra argument or supplying the missing one is the fix.
Calendar and policy inputs never arrive as extra arguments; they come
from the environment around the call.

## Example

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

entity Party;
relation party(p: Party) kind empirical;
relation scheduled(p: Party, d: Date) kind empirical;
relation due(p: Party, d: Date) kind institutional;
rule R strict {
  for p: Party; for start: Date;
  when party(p) and scheduled(p, start) and (start <= month_end_of(start));
  then due(p, add_calendar_period(start, 3 calendar_day, start));
}
```

## Fix

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

entity Party;
relation party(p: Party) kind empirical;
relation scheduled(p: Party, d: Date) kind empirical;
relation due(p: Party, d: Date) kind institutional;
rule R strict {
  for p: Party; for start: Date;
  when party(p) and scheduled(p, start) and (start <= month_end_of(start));
  then due(p, add_calendar_period(start, 3 calendar_day));
}
```

## Engine message

The engine reports this in its own wording:

```text
example.law:12:15: error LDC-E2116: add_calendar_period: declared arity of the standard term is 2; got 3. Arity is set by §257 and the term's own semantics section (§50/§58/§59/§84/§86); there is no guessing by argument count — calendar and §86 policy come from the environment, not from an argument (errata E-0119)
```

## Related

- [Expressions and quantities](/constructs/expressions-quantities/) — how standard calls are shaped.
- [Time](/constructs/time/) — what calendar functions compute.