When a spec violates a rule, the engine raises a coded diagnostic with a message, a citation, and a
precise span. An error blocks codegen, so no contract is emitted (exit 1). A warning is
advisory and does not block. Citations are flagged for scholarly verification ([scholar-verify]
for fiqh, [verify] for common law), never asserted as fatwa.
Every diagnostic is the same structure, emitted as JSON under --json or pretty-printed otherwise:
{
"severity": "error",
"code": "RIBA-1",
"message": "capital is guaranteed; a guaranteed return of capital turns a partnership into an interest-bearing loan (riba).",
"citation": "al-Baqarah 2:275; AAOIFI Shari'ah Standard No. 12 [scholar-verify]",
"span": { "line": 38, "col": 5 }
}
span points at the offending token, so the LSP underlines exactly that, the capital_guarantee
line and not the whole block. Codes are stable identifiers; the prose message may evolve.
example: a disguised loan, refused
$ deduce check specs/riba_disguised.fiqh
✗ RIBA-1 38:5 capital is guaranteed to 'bank' (riba). al-Baqarah 2:275 · AAOIFI SS No. 12
✗ RISK-1 37:5 loss must follow ownership. al-ghunm bi-l-ghurm
✗ GHARAR-1 31:7 buyout price is not oracle-derived (majhūl).
3 errors · no contract emitted
$ echo $?
1
There are roughly 109 codes. The tables below group them by the part of the law they enforce.
the consensus-oracle config is malformed (unknown mode, quorum/committee bounds, or gharar_bound_bps out of range).
CONT-1
a calamity (jāʾiḥah) may only reschedule or abate, never add a penalty or interest.
CONT-2 / CONT-3
death is distributed by farāʾiḍ, not discretion / a farāʾiḍ dissolution needs an arbiter.
CONT-4
(warning) a contingency block declares no recognized off-ramp.
INAH-1 / INAH-2 / INAH-3
bayʿ al-ʿīnah (a 2-cycle back to origin) / organised tawarruq (a ≥3-cycle ring, or a deferred-in + spot-out monetization flip) / (warning) a zero-net round-trip.
BUNDLE-1, LEG-1..4
a bundle declares no legs / a leg is missing fields, has a bad payment, references an undeclared party, or transfers an asset to itself.
BUNDLE-2
a bundle has no (or a blank) completeness_attestation — the graph search cannot prove a ring absent from legs it was never shown, so a cycle-free verdict requires an attributed claim that the legs are complete.
(warning, never blocking) a form-compliant contract whose maqṣad a scholar should examine. See Maqāṣid & the ḥiyal ceiling.
MAQASID-3
(warning, never blocking) a bundle leg takes on a deferred debt for an asset with no disposal of it declared anywhere in the bundle — the signature a hidden ring’s remainder would leave, and equally an ordinary end-consumer keeping what they bought.
META-1
(warning) no fiqh basis is cited in meta.
CLASS-1
the instrument class is unknown to the engine.
REGIME-1
the declared regime contradicts the class.
RULES-1
the active pluggable module has no entry for this class.
RULES-2
a rule module claims ratification.status: "ratified" but its content hash is missing or no longer matches — it was edited after sign-off, or never had anything to pin against.
RULES-3
(warning) a rule module has no ratification block, or isn’t yet "ratified" — treat its verdicts as draft. See Rule modules.
PARSE
a lexical or syntactic error (surfaced through the LSP and FFI).