Markdown for LLMs
TYPE_ERROR — Values of incompatible kinds meet in one computation
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# TYPE_ERROR — Values of incompatible kinds meet in one computation
## What it means
Values carry their kinds: a length in metres is not a length in
kilometres until converted, money in one currency does not mix with money
in another, dates do not compare with plain numbers. When one computation
brings two incompatible kinds together, the engine stops that question
instead of silently converting or dropping the mismatch. The report names
the clash so the author can see which two values met.
This status is about the values, not the rules. The rule is fine; the
facts fed it values its computation cannot combine.
## When you see it
```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
entity Applicant;
relation distance_to_zone(a: Applicant, d: Quantity) kind empirical { key(a); }
relation far_from_zone(a: Applicant) kind institutional;
rule FarFromZone strict {
for a: Applicant;
for d: Quantity;
when distance_to_zone(a, d) and d >= 2 km;
then far_from_zone(a);
}
```
```lawtest
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";
test "different units are not mixed" {
given {
context { legal_time @2026-03-01; decision_time @2026-03-01T09:00:00Z; knowledge_time @2026-03-01T09:00:00Z; timezone "UTC"; }
assert distance_to_zone(entity_ref("urn:demo:diagnostics:bob"), 2500 m) { origin case_input; }
}
evaluate truth(far_from_zone(entity_ref("urn:demo:diagnostics:bob")));
expect evaluation_status == TYPE_ERROR;
}
```
The rule compares against kilometres while the case states metres. The
two never mix silently, so the question ends here.
## What to do
Make the kinds agree: state the fact in the unit the rule expects, or
convert explicitly with an exact factor before comparing. Never rely on
silent conversion — the engine has none, on purpose.
## Related
- [Testing a package](/language/testing-a-package/) — how scenarios pin outcomes.
- [RUNTIME_ERROR](/diagnostics/RUNTIME_ERROR/) — when the values are fine but the step fails.