docs / Error codes

Error codes

Fifteen stable codes, defined in src/minifmt/errors.py and reproduced by the TypeScript library. They are part of the format's public contract: a validator written in another language must produce the same codes for the same documents, and the conformance suite checks it.

Each error carries a code, a line (1-based; 0 for document errors), a field when applicable and a readable message. The report identifies the line and field that need correction.

CodeConditionConstantSPEC
E01Missing headerE_NO_HEADER§5, §8
E02Prefix differs from the contractE_UNKNOWN_PREFIX§5
E03Missing `n`E_NO_COUNT§5
E04Record count differs from `n`E_COUNT_MISMATCH§5, §9
E05Record arity out of rangeE_ARITY§6, §10
E06Wrong type or empty required valueE_TYPE§6
E07List or tuple arityE_LIST_ARITY§6
E08Marker rule violatedE_MARKER§3.2, §6
E09Invalid escapeE_ESCAPE§3.3
E10Value outside the enumerationE_ENUM§6
E11Duplicated unique valueE_UNIQUE§6
E12Malformed or missing header entryE_HEADER_KEY§5
E13Outside the numeric rangeE_RANGE§6
E20Invalid contractE_CONTRACT§10
E21Family invariant violatedE_FORK§10