docs← Back to article

Markdown for LLMs

LDC-E2105 — A call to an undeclared function

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

Download this articlePlain text ↗
# LDC-E2105 — A call to an undeclared function

## What it means

A function call inside a rule needs a declaration behind it: either a
function declared in the same file or one of the standard functions
the language ships. A call to any other name is rejected at the call
site — the compiler will not invent a meaning for it.

Declaring the function with its parameters and result, correcting a
misspelled name, or switching to the intended standard function fixes
it.

## Example

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

entity P;
relation seen(a: P) kind institutional;
relation noted(a: P) kind institutional;
rule R strict { for x: P; when seen(mystery(x)); then noted(x); }
```

## Fix

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

entity P;
function mystery(x: P) -> P = x;
relation seen(a: P) kind institutional;
relation noted(a: P) kind institutional;
rule R strict { for x: P; when seen(mystery(x)); then noted(x); }
```

## Engine message

The engine reports this in its own wording:

```text
example.law:8:37: error LDC-E2105: function "mystery" is not declared (neither in the file nor in the std v1 list)
```

## Related

- [Expressions and quantities](/constructs/expressions-quantities/) — how function calls are written.