docs / Códigos de errorError codes
Códigos de error
Quince códigos estables, definidos en src/minifmt/errors.py y reproducidos por la biblioteca TypeScript.
Son parte del contrato público del formato: un validador escrito en otro lenguaje debe producir los mismos códigos
para los mismos documentos, y la suite de conformidad lo comprueba.
Cada error lleva código, línea (1-based; 0 para errores de documento), campo cuando aplica y un mensaje legible. El informe identifica la línea y el campo que debe corregirse.
| Código | Condición | Constante | SPEC |
|---|---|---|---|
| E01 | Falta la cabecera | E_NO_HEADER | §5, §8 |
| E02 | Prefijo distinto del contrato | E_UNKNOWN_PREFIX | §5 |
| E03 | Falta `n` | E_NO_COUNT | §5 |
| E04 | Número de registros distinto de `n` | E_COUNT_MISMATCH | §5, §9 |
| E05 | Aridad del registro fuera de rango | E_ARITY | §6, §10 |
| E06 | Tipo incorrecto o requerido vacío | E_TYPE | §6 |
| E07 | Aridad de lista o tupla | E_LIST_ARITY | §6 |
| E08 | Regla del marcador violada | E_MARKER | §3.2, §6 |
| E09 | Escape inválido | E_ESCAPE | §3.3 |
| E10 | Valor fuera de la enumeración | E_ENUM | §6 |
| E11 | Valor único duplicado | E_UNIQUE | §6 |
| E12 | Entrada de cabecera malformada o ausente | E_HEADER_KEY | §5 |
| E13 | Fuera de rango numérico | E_RANGE | §6 |
| E20 | Contrato inválido | E_CONTRACT | §10 |
| E21 | Invariante de familia violado | E_FORK | §10 |
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.
| Code | Condition | Constant | SPEC |
|---|---|---|---|
| E01 | Missing header | E_NO_HEADER | §5, §8 |
| E02 | Prefix differs from the contract | E_UNKNOWN_PREFIX | §5 |
| E03 | Missing `n` | E_NO_COUNT | §5 |
| E04 | Record count differs from `n` | E_COUNT_MISMATCH | §5, §9 |
| E05 | Record arity out of range | E_ARITY | §6, §10 |
| E06 | Wrong type or empty required value | E_TYPE | §6 |
| E07 | List or tuple arity | E_LIST_ARITY | §6 |
| E08 | Marker rule violated | E_MARKER | §3.2, §6 |
| E09 | Invalid escape | E_ESCAPE | §3.3 |
| E10 | Value outside the enumeration | E_ENUM | §6 |
| E11 | Duplicated unique value | E_UNIQUE | §6 |
| E12 | Malformed or missing header entry | E_HEADER_KEY | §5 |
| E13 | Outside the numeric range | E_RANGE | §6 |
| E20 | Invalid contract | E_CONTRACT | §10 |
| E21 | Family invariant violated | E_FORK | §10 |