docs← Back to article

Markdown for LLMs

LDC-Q2008 — The query calls a function the language does not define

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

Download this articlePlain text ↗
# LDC-Q2008 — The query calls a function the language does not define

## What it means

Expressions in a query can call a small fixed set of helpers for working
with rows — shortening names, reading labels, testing membership. Any
other name is not a call the engine can run, so the query stops at it, and
the message lists the helpers that do exist.

Use one of the listed helpers, or move the computation out of the query:
derive the value with a rule in the package instead.

## Example

Both queries below run against this package:

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

entity Applicant;
relation resident(a: Applicant) kind institutional;
relation permit_eligible(a: Applicant) kind institutional;

rule PermitEligibility strict {
    for a: Applicant;
    when resident(a);
    then permit_eligible(a);
}
```

No helper carries this name:

```lawql
from r in rules select nosuchfunc(r.id)
```

## Fix

```lawql
from r in rules select r
```

## Engine message

The engine reports this in its own wording:

```text
LDC-Q2008: unknown function 'nosuchfunc'. Hint: available: anchor, labels, short, contains, overlaps, starts_with, ends_with, position, derivation
```

## Related

- [Questions to the engine](/constructs/queries/) — the helpers a query can call.
- [LDC-Q2009](/diagnostics/LDC-Q2009/) — when a known helper gets the wrong count.