docs← Back to article

Markdown for LLMs

RUNTIME_ERROR — A computation step fails on good values

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

Download this articlePlain text ↗
# RUNTIME_ERROR — A computation step fails on good values

## What it means

Sometimes every value is well-formed and well-typed, yet a single step
cannot run: a division by a zero the case supplied, an aggregate over an
empty collection, a value outside a function's domain. The rule that
needs the step cannot fire, and the question that needs the rule ends
with this status. The report names the failed step so the author can see
exactly which computation broke.

This status is about the step, not the package. The rules are fine; one
of their computations met an input it cannot process.

## 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 divisor(a: Applicant, n: Integer) kind empirical { key(a); }
relation quotient_ok(a: Applicant) kind institutional;

rule Quotient strict {
    for a: Applicant;
    for n: Integer;
    when divisor(a, n) and 10 / n >= 10 / 1;
    then quotient_ok(a);
}
```

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

test "zero divisor" {
    given {
        context { legal_time @2026-03-01; decision_time @2026-03-01T09:00:00Z; knowledge_time @2026-03-01T09:00:00Z; timezone "UTC"; }
        assert divisor(entity_ref("urn:demo:diagnostics:ann"), 0) { origin case_input; }
    }
    evaluate truth(quotient_ok(entity_ref("urn:demo:diagnostics:ann")));
    expect evaluation_status == RUNTIME_ERROR;
}
```

The case supplies zero as the divisor, and division by zero cannot run.
The question ends here.

## What to do

Fix the input the step choked on, or guard the rule so the step only runs
where it is defined — for example, require a nonzero divisor before
dividing. Then ask the question again.

## Related

- [Testing a package](/language/testing-a-package/) — how scenarios pin outcomes.
- [TYPE_ERROR](/diagnostics/TYPE_ERROR/) — when the values themselves clash by kind.