docs← Back to article

Markdown for LLMs

LDC-Q2006 — The expression reads a field of a value that has none

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

Download this articlePlain text ↗
# LDC-Q2006 — The expression reads a field of a value that has none

## What it means

Dotted reads walk into structured rows: each step must land on something
with named fields. When a step lands on a plain value — a name, a number,
a date — there is nothing further to walk into, and the engine stops at
that step. The row is fine; the path through it goes one step too far.

Shorten the path to the structured value, or compare that value directly
instead of reading into it.

## 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);
}
```

The identifier of a rule is a plain name, so reading further into it fails:

```lawql
from r in rules where r.id.foo == 1 select r
```

## Fix

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

## Engine message

The engine reports this in its own wording:

```text
LDC-Q2006: r has no field 'foo'.
```

## Related

- [Questions to the engine](/constructs/queries/) — how sources bind names.
- [LDC-Q2005](/diagnostics/LDC-Q2005/) — when the leading name itself is unbound.