Markdown for LLMs
LDC-Q4001 — A question over a package needs its binder up front
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-Q4001 — A question over a package needs its binder up front
## What it means
A question over a package reasons about things of a declared kind: every
name used in the conditions must first be introduced together with its
kind. Without that introduction the engine cannot tell what the names
range over, so it stops before reading any condition. The same code also
fires when a name is introduced twice — the second introduction would
leave the range ambiguous.
Introduce each name exactly once with its kind before the conditions. The
conditions themselves stay as written.
## Example
```lawql
query q over "demo.diagnostics" { where resident(x); select resident(x); }
```
## Fix
```lawql
from r in rules select r
```
## Engine message
The engine reports this in its own wording:
```text
LDC-Q4001: query-over requires an explicit `for x: T;`.
```
## Related
- [Questions to the engine](/constructs/queries/) — the shape of a question over a package.
- [LDC-Q4007](/diagnostics/LDC-Q4007/) — when the binder names an unknown kind.