# COMPILE_FAILED

The DSAIL source did not compile. HTTP 422. The response carries line-numbered diagnostics and the grammar guide; fix the source and compile again.

The ruleset source you submitted does not compile. The envelope carries every diagnostic with its line number, and `hint` — the full grammar guide — so the next call can succeed without a human.

## The envelope

```json
{"ok": false,
 "error": {"code": "COMPILE_FAILED",
           "message": "assertion `cap` compares the united claim `amount` (USD) against the unsigned literal 25000; write the unit on the literal (25000 \"USD\")",
           "docs": "https://docs.agents.jaxon.ai/errors/compile-failed.md",
           "diagnostics": [{"severity": "error", "line": 5, "message": "..."}],
           "hint": "DSAIL ruleset grammar (v1.3) ..."},
 "versions": {"...": "..."}}
```

## The mistakes models actually make

- **A united claim compared with a bare number.** `@unit amount USD` and
  `amount <= 25000`. Write `25000 "USD"`. This is enforced because a bare
  literal adopts the unit of whatever it meets, and a 24,000 EUR claim would be
  judged against a 25,000 EUR cap the policy never wrote. Zero is not exempt:
  write `0 "USD"`.
- **Infix logic.** There is no `and`, `or`, `not`. Write `And(a, b)`, `Or(a, b)`,
  `Not(a)`, `Implies(a, b)`.
- **`=` for equality.** Equality is `==`.
- **A missing semicolon.** Every statement ends with one.
- **Single-quoted enum members.** Members are double-quoted strings.
- **`@effect`, `@effect-default` or `@consistency`.** Not recognised; a ruleset
  carrying one does not compile. Annotations describe claims (`@ask`,
  `@context`, `@range`, `@unit`), never outcomes.
- **Two assertions with one name.** Refused, because the second would be
  silently unevaluated.
- **`let` bindings for claim values.** Do not write them; the service injects
  them from the claim dictionary at check time.

## Then

Fix the source and call compile again. Compile renders nothing and may be
iterated freely; present the ruleset to a person (`dsail_review`) only once it
compiles clean. The grammar is also on this site, verbatim, in the
[MCP server instructions](../reference/server-instructions.md).

See also: [Turn a policy document into rules a program can check](../guides/policy-to-rules.md).
