Reading Diagnostics
Without --format json, miri check prints errors for people:
$ miri check tally.mi
error[MER_PAR_020]: Unsupported C-Style Operator
--> tally.mi:9:18
|
9 | if s > 5 && s < 10
| ^^ '&&' is not a valid operator in Miri
|
= help: Miri spells logical and as the word `and`: `if a and b`.
|
exit status 1
With --format json it prints the same information as one JSON object on standard output. Every
command that takes --format json — check, build, run,
test, fix, explain, view, patch, skill —
answers in this same shape, so an agent only learns to read it once.
The fields an agent needs most:
ok— whether the command did what was asked. Warnings never make itfalse.exitCode— the same number the process exits with.diagnostics— one entry per problem, each with:code— a stable name such asMER_TYP_042. Pass it tomiri explainfor the full rule.line,columnandlength— where the problem is, counted in characters from 1.help— one sentence on what to do instead.repair— when present, the exact edits that fix it: byte offsetsstartandendin the file, and thereplacementtext.miri fixapplies them for you, or an agent can apply them itself.fixSafety— how safe the fix is to apply without a person looking (see Repairs).
Every field is listed in the JSON reference.