Markdown for LLMs
LDC-Q2003 — A computed document field is not a list of rows
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-Q2003 — A computed document field is not a list of rows
## What it means
A query can run a package over a case file first and then read rows
from the produced document by naming one of its fields. Every field
read this way must hold a list of rows. When the named field holds
anything else — a single value, or nothing at all — there are no rows
to read, and the engine names the field instead of guessing.
Point the source at a field that holds a list of rows, or drop the
computed source when the snapshot relations already carry the rows.
## Example
```run
{"argv": ["query", "$ROOT/q.lawq", "--path", "$ROOT/world.json", "--limit", "5"], "files": {"q.lawq": "let m = eval(\"demo.diagnostics\", \"c.json\") from x in m.nosuchrel select x", "world.json": "{\"artifactHash\":\"sha256:6a9091bdeb56f398762394bb3ab882a8f44d541a1dd0dfd9ea65d4e9cac99d78\",\"features\":[\"core-executable\"],\"imports\":[],\"metadata\":{},\"nodes\":[{\"contentHash\":\"sha256:65449c25ae110f10c02d875734707f013f7fcae27b6c779700c6a2eb82fd00fc\",\"id\":\"urn:law:demo:diagnostics#Applicant\",\"kind\":\"type_decl\",\"name\":\"Applicant\",\"package\":\"urn:law:demo:diagnostics\",\"typeKind\":\"entity\"},{\"contentHash\":\"sha256:b62227d3c949b697a7bad486d2cd64dcd4ddaccef32710bd994226fd43e3033e\",\"id\":\"urn:law:demo:diagnostics#resident\",\"kind\":\"symbol_decl\",\"name\":\"resident\",\"package\":\"urn:law:demo:diagnostics\",\"parameters\":[{\"id\":\"urn:law:demo:diagnostics#resident/arg/a\",\"name\":\"a\",\"type\":{\"name\":\"urn:law:demo:diagnostics#Applicant\"}}],\"relationKind\":\"institutional\",\"symbolKind\":\"relation\"}],\"package\":{\"name\":\"demo.diagnostics\",\"namespace\":\"urn:law:demo:diagnostics\",\"semanticHash\":\"sha256:0000000000000000000000000000000000000000000000000000000000000000\",\"version\":\"0.1.0\"},\"schemaVersion\":\"law.core.ir/0.2\",\"semanticHash\":\"sha256:82a883cd86acd37faec9d0502a7498490966e772c41e0c750647a60f29c53010\",\"semanticVersion\":\"0.2.4\",\"strata\":[],\"theoryHash\":\"sha256:82a883cd86acd37faec9d0502a7498490966e772c41e0c750647a60f29c53010\"}", "c.json": "{}"}, "expect": "LDC-Q2003"}
```
## Fix
```run
{"argv": ["query", "$ROOT/q.lawq", "--path", "$ROOT/world.json", "--limit", "5"], "files": {"q.lawq": "let m = eval(\"demo.diagnostics\", \"c.json\") from r in rules select r", "world.json": "{\"artifactHash\":\"sha256:6a9091bdeb56f398762394bb3ab882a8f44d541a1dd0dfd9ea65d4e9cac99d78\",\"features\":[\"core-executable\"],\"imports\":[],\"metadata\":{},\"nodes\":[{\"contentHash\":\"sha256:65449c25ae110f10c02d875734707f013f7fcae27b6c779700c6a2eb82fd00fc\",\"id\":\"urn:law:demo:diagnostics#Applicant\",\"kind\":\"type_decl\",\"name\":\"Applicant\",\"package\":\"urn:law:demo:diagnostics\",\"typeKind\":\"entity\"},{\"contentHash\":\"sha256:b62227d3c949b697a7bad486d2cd64dcd4ddaccef32710bd994226fd43e3033e\",\"id\":\"urn:law:demo:diagnostics#resident\",\"kind\":\"symbol_decl\",\"name\":\"resident\",\"package\":\"urn:law:demo:diagnostics\",\"parameters\":[{\"id\":\"urn:law:demo:diagnostics#resident/arg/a\",\"name\":\"a\",\"type\":{\"name\":\"urn:law:demo:diagnostics#Applicant\"}}],\"relationKind\":\"institutional\",\"symbolKind\":\"relation\"}],\"package\":{\"name\":\"demo.diagnostics\",\"namespace\":\"urn:law:demo:diagnostics\",\"semanticHash\":\"sha256:0000000000000000000000000000000000000000000000000000000000000000\",\"version\":\"0.1.0\"},\"schemaVersion\":\"law.core.ir/0.2\",\"semanticHash\":\"sha256:82a883cd86acd37faec9d0502a7498490966e772c41e0c750647a60f29c53010\",\"semanticVersion\":\"0.2.4\",\"strata\":[],\"theoryHash\":\"sha256:82a883cd86acd37faec9d0502a7498490966e772c41e0c750647a60f29c53010\"}", "c.json": "{}"}, "expect": "LDC-Q2003"}
```
## Engine message
The engine reports this in its own wording:
```text
LDC-Q2003: m.nosuchrel is not an array.
```
## Related
- [Questions to the engine](/constructs/queries/) — how a query runs a package over a case.
- [LDC-Q2002](/diagnostics/LDC-Q2002/) — when the computed document itself is undeclared.
- [LDC-Q3001](/diagnostics/LDC-Q3001/) — when the computation states no row cap.