MIRR Error Code Reference

Status: Active Last updated: 2026-03-17 (MEGA-10: E222–E228, E720)

All MIRR compiler diagnostics carry a bracketed error code in the format [Ennn]. The prefix classifies the error; the full code maps to a single creation site.

Error Code Scheme

PrefixRangeCategoryVariant
E1xx100–199Parse / lexical + MEGA-1 annotationsMirrError::ParseError
E2xx200–299Semantic analysisMirrError::SemanticError
E3xx300–399Temporal compilationMirrError::TemporalCompilationError
E4xx400–499Pattern expansionMirrError::PatternError
E5xx500–599Width inferenceWidthDiag (subsystem-local)
E6xx600–699Type checkingMirrError::TypeError
E7xx700–799R-SPU emissionMirrError::RspuError
E8xx800–899S-expressionMirrError::SExprError

Parse Errors — Module (E100–E166)

CodeMessage patternSource
E100(category fallback prefix)src/error.rs
E101MIRR source is empty.src/parser/module_parser.rs
E102Expected 'module' declaration but found end of file.src/parser/module_parser.rs
E103Expected 'module' declaration, found: {header}src/parser/module_parser.rs
E104Malformed module declaration.src/parser/module_parser.rs
E105Module name cannot be empty.src/parser/module_parser.rs
E106Module '{name}' was not closed with '}'.src/parser/module_parser.rs
E107Unexpected line inside module '{name}': {line}src/parser/module_parser.rs
E108Malformed signal declaration.src/parser/module_parser.rs
E109Signal declaration must end with ';'.src/parser/module_parser.rs
E110Signal declaration must contain ':'.src/parser/module_parser.rs
E111Signal name cannot be empty.src/parser/module_parser.rs
E112Signal kind (in/out/internal) is missing.src/parser/module_parser.rs
E113Signal type (bool/uN) is missing.src/parser/module_parser.rs
E114Too many tokens in signal declaration.src/parser/module_parser.rs
E115Unknown signal kind: {other}. Expected 'in', 'out', or 'internal'.src/parser/module_parser.rs
E116Invalid unsigned width in type '{ty_str}'.src/parser/module_parser.rs
E117Invalid signed width in type '{ty_str}'.src/parser/module_parser.rs
E118Unknown signal type: {ty_str}. Expected 'bool', 'uN', or 'iN'.src/parser/module_parser.rs
E119Unexpected end of file in guard declaration.src/parser/module_parser.rs
E120Malformed guard declaration.src/parser/module_parser.rs
E121Guard name cannot be empty.src/parser/module_parser.rs
E122Guard '{name}' missing 'when' clause.src/parser/module_parser.rs
E123Guard '{name}' expected 'when' line, found: {line}src/parser/module_parser.rs
E124Malformed 'when' line.src/parser/module_parser.rs
E125Guard '{name}' condition parse error: {e}src/parser/module_parser.rs
E126Guard '{name}' missing 'for' clause.src/parser/module_parser.rs
E127Guard '{name}' expected 'for' line, found: {line}src/parser/module_parser.rs
E128Malformed 'for' line.src/parser/module_parser.rs
E129Expected cycle count after 'for'.src/parser/module_parser.rs
E130Invalid cycle count in guard '{name}': {str}src/parser/module_parser.rs
E131Guard '{name}' not closed with '}'.src/parser/module_parser.rs
E132Guard '{name}' expected closing '}', found: {line}src/parser/module_parser.rs
E133Assignment missing '=': {line}src/parser/module_parser.rs
E134Assignment target cannot be empty.src/parser/module_parser.rs
E135Assignment to '{target}' has empty right-hand side.src/parser/module_parser.rs
E136Error in assignment to '{target}': {e}src/parser/module_parser.rs
E137Unexpected end of file in reflex declaration.src/parser/module_parser.rs
E138Malformed reflex declaration.src/parser/module_parser.rs
E139Reflex name cannot be empty.src/parser/module_parser.rs
E140Reflex '{name}' missing 'on' clause.src/parser/module_parser.rs
E141Reflex '{name}' expected 'on' line, found: {line}src/parser/module_parser.rs
E142Malformed 'on' line.src/parser/module_parser.rs
E143Reflex '{name}' has no guard names in 'on' clause.src/parser/module_parser.rs
E144In reflex '{name}': {e}src/parser/module_parser.rs
E145Reflex '{name}' not closed with '}'.src/parser/module_parser.rs
E146Reflex '{name}' expected closing '}', found: {line}src/parser/module_parser.rs
E147Unexpected end of file in property declaration.src/parser/module_parser.rs
E148Malformed property declaration.src/parser/module_parser.rs
E149Property name cannot be empty.src/parser/module_parser.rs
E150Property '{name}' missing formula (always/never).src/parser/module_parser.rs
E151Property '{name}' not closed with '}'.src/parser/module_parser.rs
E152Property '{name}' expected closing '}', found: {line}src/parser/module_parser.rs
E153Property '{name}' formula must start with 'always', 'never', or 'eventually'.src/parser/module_parser.rs
E154Property '{name}': {keyword} formula must be wrapped in parentheses.src/parser/module_parser.rs
E155Property '{name}' antecedent error: {e}src/parser/module_parser.rs
E156Property '{name}' consequent error: {e}src/parser/module_parser.rs
E157Property '{name}' formula error: {e}src/parser/module_parser.rs
E158Property '{name}': expected 'eventually within N (expr)'.src/parser/module_parser.rs
E159Property '{name}': eventually within requires parenthesized expression.src/parser/module_parser.rs
E160Property '{name}': invalid cycle count '{str}' in eventually within.src/parser/module_parser.rs
E161Property '{name}': eventually within requires cycles >= 1.src/parser/module_parser.rs
E162Property '{name}': expected 'P followed_by N Q' with delay and response expression.src/parser/module_parser.rs
E163Property '{name}': invalid delay '{str}' in followed_by.src/parser/module_parser.rs
E164Property '{name}': followed_by requires delay >= 1.src/parser/module_parser.rs
E165Property '{name}' trigger error: {e}src/parser/module_parser.rs
E166Property '{name}' response error: {e}src/parser/module_parser.rs

Parse Errors — Expressions (E170–E181)

CodeMessage patternSource
E170Empty expression.src/parser/expr_parser.rs
E171Unbalanced parentheses in expression.src/parser/expr_parser.rs
E172Expression depth exceeds limit of {N}.src/parser/expr_parser.rs
E173Unexpected end of expression.src/parser/expr_parser.rs
E174Unexpected token at start of expression: {token}src/parser/expr_parser.rs
E175Expected closing ')' in expression.src/parser/expr_parser.rs
E176Unexpected token in expression: {token}src/parser/expr_parser.rs
E180Integer literal too large: '{str}'.src/lexer/tokenizer.rs
E181Unexpected character '{c}' in expression.src/lexer/tokenizer.rs

Parse Errors -- MEGA-1 Type Annotations (E177–E183, E190–E197)

Note: E177-E183 are used by both the expression tokenizer/parser and the MEGA-1 type annotation parser (src/parser/mod.rs). E190-E197 are exclusive to the MEGA-1 annotation parser and were assigned during MEGA-7.

CodeMessage patternSource
E177Invalid clock domain name.src/parser/mod.rs
E178Empty phantom tag after '#'.src/parser/mod.rs
E179Invalid phantom tag (must be uppercase identifier).src/parser/mod.rs
E182Duplicate phantom tag annotation.src/parser/mod.rs
E183Too many tokens / unexpected token in signal declaration.src/parser/mod.rs
E190Duplicate 'linear' qualifier in signal declaration.src/parser/mod.rs
E191Conflicting effect qualifier: already have {existing}.src/parser/mod.rs
E192Missing base type after qualifiers.src/parser/mod.rs
E193Empty/malformed refinement clause.src/parser/mod.rs
E194Invalid refinement range: lower bound exceeds upper bound.src/parser/mod.rs
E195Empty clock domain after '@'.src/parser/mod.rs
E196Duplicate 'where' clause in signal declaration.src/parser/mod.rs
E197Duplicate clock domain annotation.src/parser/mod.rs

Semantic Errors (E2xx)

CodeMessage patternSource
E201Duplicate signal name: '{name}'.src/validation/semantic.rs
E202Duplicate guard name: '{name}'.src/validation/semantic.rs
E203Duplicate reflex name: '{name}'.src/validation/semantic.rs
E204Guard '{name}' references undeclared signal '{sig}'.src/validation/semantic.rs
E205Reflex '{name}' references undeclared guard '{guard}'.src/validation/semantic.rs
E206Reflex '{name}' assigns to input signal '{sig}', which is not writable.src/validation/semantic.rs
E207Reflex '{name}' assigns to undeclared signal '{sig}'.src/validation/semantic.rs
E208Reflex '{name}' assignment references undeclared signal '{sig}'.src/validation/semantic.rs
E209'{context}' contains prev('{sig}') with delay 0; delay must be >= 1.src/validation/semantic.rs
E210Duplicate property name: '{name}'.src/validation/semantic.rs
E211Property '{name}' references undeclared signal '{sig}'.src/validation/semantic.rs
E212signal '{sig}' is internal to pattern '{pat}' and cannot be referenced externallysrc/expand/mod.rs (hand-written reflex target)
E213signal '{sig}' is internal to pattern '{pat}' and cannot be referenced externallysrc/expand/mod.rs (hand-written expression)
E214signal '{sig}' is internal to pattern '{pat}' and cannot be referenced externallysrc/expand/mod.rs (cross-expansion target)
E215signal '{sig}' is internal to pattern '{pat}' and cannot be referenced externallysrc/expand/mod.rs (cross-expansion expression)
E216Signal '{sig}' has multiple writers: reflex '{r1}' and reflex '{r2}'.src/validation/semantic.rs
E229No field '{field}' on struct signal '{sig}'.src/validation/semantic.rs
E230Signal '{sig}' is not an array type but is indexed.src/validation/semantic.rs
E217Duplicate pattern definition: '{name}'.src/validation/semantic.rs
E218Pattern '{name}' has duplicate parameter name: '{param}'.src/validation/semantic.rs
E219Pattern '{name}' has {N} parameters (max {M}).src/validation/semantic.rs
E220Pattern '{name}' has empty reflect body.src/validation/semantic.rs
E221Pattern '{name}' reflect body exceeds max lines.src/validation/semantic.rs
E222(reserved: MEGA-10 composite type parsing)
E223(reserved: MEGA-10 array type validation)
E224(reserved: MEGA-10 struct field count exceeded)
E225(reserved: MEGA-10 fixed-point bit width exceeded)
E226Operator '{op}' cannot be applied to composite type '{ty}'.src/typeck/mod.rs
E227(reserved: MEGA-10 bundle elaboration)
E228(reserved: MEGA-10 array index out of bounds)

ERR-001 enhancements: E204, E205, E207, E208, E211 now include "Did you mean '{closest}'?" when a close match exists. E201, E202, E203, E210, E216 now include "First defined at line N." when a span is available.

Temporal Errors (E3xx)

CodeMessage patternSource
E300(category fallback prefix)src/error.rs
E301Exceeded maximum compile guard depth ({N}).src/temporal/compiler.rs
E302Condition cannot be lowered to hardware -- {reason}src/temporal/compiler.rs
E303Internal error — missing sub-guard result.src/temporal/compiler.rs
E304Compilation exceeded maximum iteration bound ({N}).src/temporal/compiler.rs
E305Internal error — no compilation result.src/temporal/compiler.rs
E306Condition cannot be lowered -- {reason}src/temporal/compiler.rs
JSON serialization failed: {e}src/temporal/emit.rs

Pattern Errors (E4xx)

Semantic-level (E400)

CodeMessage patternSource
E400Too many pattern definitions (max {N}).src/parser/module_parser.rs

Pattern validation errors E217–E221 are in the Semantic Errors table above.

Parse-level (E401–E425)

CodeMessage patternSource
E401Unexpected end of file in pattern definition.src/parser/pattern_parser.rs
E402Malformed pattern definition.src/parser/pattern_parser.rs
E403Pattern definition missing '('.src/parser/pattern_parser.rs
E404Pattern name cannot be empty.src/parser/pattern_parser.rs
E405Pattern '{name}' missing closing ')'.src/parser/pattern_parser.rs
E406Pattern '{name}' missing 'reflect' block.src/parser/pattern_parser.rs
E407Pattern '{name}' expected 'reflect' block, found: {line}src/parser/pattern_parser.rs
E408Pattern '{name}' reflect block missing opening '{'.src/parser/pattern_parser.rs
E409Pattern definition header not closed with ') {'.src/parser/pattern_parser.rs
E410Pattern '{name}' has too many parameters (max {N}).src/parser/pattern_parser.rs
E411Pattern '{name}' parameter missing ':': {str}src/parser/pattern_parser.rs
E412Pattern '{name}' has parameter with empty name.src/parser/pattern_parser.rs
E413Pattern '{name}' signal parameter '{param}' missing direction.src/parser/pattern_parser.rs
E414Pattern '{name}' parameter '{param}': unknown signal kind '{kind}'.src/parser/pattern_parser.rs
E415Pattern '{name}' signal parameter '{param}' missing type.src/parser/pattern_parser.rs
E416Pattern '{name}' parameter '{param}': invalid type '{ty}'.src/parser/pattern_parser.rs
E417Pattern '{name}' parameter '{param}': unknown type '{ty}'. Expected 'bool', 'uN', or 'iN'.src/parser/pattern_parser.rs
E418Pattern '{name}' reflect body exceeds maximum brace depth ({N}).src/parser/pattern_parser.rs
E419Pattern '{name}' reflect block not closed with '}'.src/parser/pattern_parser.rs
E420Pattern call must end with ';'.src/parser/pattern_parser.rs
E421Pattern call missing '('.src/parser/pattern_parser.rs
E422Pattern call has empty name.src/parser/pattern_parser.rs
E423Pattern call '{name}' missing closing ')'.src/parser/pattern_parser.rs
E424Pattern call '{name}' has too many arguments (max {N}).src/parser/pattern_parser.rs
E425Pattern call '{name}' has empty argument.src/parser/pattern_parser.rs
E426Pattern '{name}' parameter '{param}' has kind 'pattern' but argument is not a pattern reference.src/expand/substitution.rs
E427Pattern '{name}' parameter '{param}' does not accept a pattern reference.src/expand/substitution.rs
E428Circular pattern reference detected: {cycle}.src/expand/cycles.rs

Width Inference Errors (E5xx)

CodeMessage patternSource
E500expression tree exceeds maximum node count (512)src/width/mod.rs
E501signal '{name}' has no declared widthsrc/width/constraint.rs
E502prev signal '{name}' has no declared widthsrc/width/constraint.rs
E503node {id} ({desc}) has unresolved widthsrc/width/solver.rs
E504node {id} ({desc}) requires {n} bits, exceeding maximum of 64src/width/solver.rs
E505assignment to '{target}' truncates {signed|unsigned} {n} bits to {m} bitssrc/width/solver.rs
E506SCC detection exceeded iteration budgetsrc/width/scc.rs
E507SCC with {n} signals exceeds maximum size of {max}; signals include: {names}src/width/scc.rs
E508nonexpansive SCC solver exceeded iteration budgetsrc/width/scc_solver.rs
E509signal '{name}' in nonexpansive SCC has no width anchor (add an explicit type annotation)src/width/scc_solver.rs
E510signal '{name}' is in an expansive SCC but has no provable width bound.src/width/scc_solver.rs
E511COMPILER BUG: signal '{name}' solved width {i|u}{n} is less than declared {i|u}{m}src/width/verify.rs
Important

Error E511 indicates a compiler bug -- the solved width is narrower than the declared type. If you encounter this error, please file a bug report with the .mirr source that triggered it.

ERR-001 enhancements: All WidthDiag instances now carry .code, .signal_name, and .help fields for structured diagnostic rendering.

Type Errors (E6xx)

CodeMessage patternSource
E601Guard '{name}' condition must be bool, got {ty}.src/typeck/mod.rs
E602Assignment to '{target}' ({target_ty}): expression type {expr_ty} is not compatible.src/typeck/mod.rs
E603Operator '{op}' requires numeric operands, got {left_ty} and {right_ty}.src/typeck/mod.rs
E604Operator '{op}' requires bool operands, got {left_ty} and {right_ty}.src/typeck/mod.rs
E605Ordering operator '{op}' cannot compare {left_ty} and {right_ty}.src/typeck/mod.rs
E606Equality operator '{op}' cannot compare {left_ty} and {right_ty}.src/typeck/mod.rs
E607Operator '^' (xor) requires matching types, got {left_ty} and {right_ty}.src/typeck/mod.rs
E608Operator '{op}' cannot mix signed and unsigned operands: {left} and {right}.src/typeck/mod.rs
E609Operator '-' (negate) cannot be applied to bool.src/typeck/mod.rs

ERR-001 change: E603 was previously overloaded for three distinct error conditions. E608 (mixed signedness) and E609 (negate bool) were split out as unique codes.

Extended Type Errors -- MEGA-1 (E610--E625)

Status: Error codes defined in src/typeck/extended.rs. Extended type checker is implemented but not yet wired into the compilation pipeline (orphaned).

CodeRuleDescriptionSource
E610REF-BOUNDRefinement lower bound exceeds upper bound.src/typeck/extended.rs
E611REF-RANGEValue outside refinement range at compile time.src/typeck/extended.rs
E612REF-WIDTHRefinement bound exceeds declared bit-width capacity.src/typeck/extended.rs
E613LIN-UNUSEDLinear signal declared but never consumed.src/typeck/extended.rs
E614LIN-DOUBLELinear signal consumed more than once.src/typeck/extended.rs
E615LIN-ESCAPELinear signal escapes owning module boundary.src/typeck/extended.rs
E616EFF-PUREStateful operation in pure (combinational) context.src/typeck/extended.rs
E617EFF-MIXStateful signal used in pure expression.src/typeck/extended.rs
E618CLK-CROSSClock domain crossing without synchronizer.src/typeck/extended.rs
E619CLK-UNDEFReference to undeclared clock domain.src/typeck/extended.rs
E620PHT-MISMATCHPhantom tag mismatch in assignment.src/typeck/extended.rs
E621PHT-UNDEFReference to undeclared phantom tag.src/typeck/extended.rs
E622NAT-OVERFLOWType-level natural exceeds MAX_TYPE_NAT (65536).src/typeck/extended.rs
E623NAT-MISMATCHType-level natural dimension mismatch.src/typeck/extended.rs
E624DEP-MISMATCHDependent type parameter mismatch.src/typeck/extended.rs
E625SES-PROTOCOLSession type protocol violation.src/typeck/extended.rs

R-SPU Emission Errors (E7xx)

CodeMessage patternSource
E700(category fallback prefix)src/error.rs
E701R-SPU register allocation failed: too many {kind} signals ({count} > {max}).src/emit/rspu_regalloc.rs
E702R-SPU instruction budget exceeded: {count} instructions > {max}.src/emit/rspu.rs
E703R-SPU guard resource exhausted: {count} guards > {max}.src/emit/rspu.rs
E704R-SPU expression exceeds maximum node count.src/emit/rspu.rs
E705R-SPU temporary registers exhausted.src/emit/rspu.rs
E706R-SPU encoding field overflow: immediate/register exceeds bit-width.src/emit/rspu_encoding.rs
E707R-SPU unknown or reserved opcode in binary stream.src/emit/rspu_encoding.rs
E708R-SPU tag violation: runtime type mismatch on tagged register.src/emit/rspu_tagged.rs
E709R-SPU uninitialized register read.src/emit/rspu_tagged.rs
E710R-SPU guard index out of bounds.src/emit/rspu_exceptions.rs
E711R-SPU exception depth overflow: nested traps exceed MAX_EXCEPTION_DEPTH.src/emit/rspu_exceptions.rs
E712R-SPU simulation cycle budget exceeded (MAX_SIM_CYCLES).src/emit/rspu_sim.rs
E713R-SPU trap handler table overflow: exceeds MAX_TRAP_HANDLERS.src/emit/rspu_exceptions.rs
E714R-SPU invalid execution mode for ModeSwitch.src/emit/rspu_exceptions.rs
E715R-SPU deadline expired: DeadlineSet counter reached zero.src/emit/rspu_sim.rs
E720R-SPU does not support composite type expressions.src/emit/rspu.rs

ERR-001 changes: E701 was previously overloaded — temporary register exhaustion is now E705. E702 was previously overloaded — expression node count is now E704. E706–E715 were activated by MEGA-3 (R-SPU ISA v2): binary encoding, tagged words, exception model, dual-mode execution, and cycle-accurate simulator.

S-Expression Errors (E800--E815)

Status: Error codes defined in src/sexpr/ modules. S-expression parser, eval, macro expander, and reader macros are implemented and tested but eval/macro/reader are not yet wired into the main compilation pipeline (orphaned).

CodeRuleDescriptionSource
E800SEXPR-PARSEGeneral S-expression parse errorsrc/sexpr/parser.rs
E801SEXPR-EOFUnexpected end of S-expression inputsrc/sexpr/parser.rs
E802SEXPR-PARENUnbalanced parenthesessrc/sexpr/parser.rs
E803SEXPR-DEPTHNesting exceeds MAX_SEXPR_DEPTH (64)src/sexpr/parser.rs
E804SEXPR-SIZETree exceeds MAX_SEXPR_NODES (4096)src/sexpr/parser.rs
E805SEXPR-FORMUnknown S-expression formsrc/sexpr/convert.rs
E806SEXPR-FIELDMissing required field in S-expression nodesrc/sexpr/convert.rs
E807SEXPR-TYPEInvalid type in S-expressionsrc/sexpr/convert.rs
E808SEXPR-LITInvalid literal value in S-expressionsrc/sexpr/reader.rs
E809SEXPR-CONVAST to S-expr conversion errorsrc/sexpr/convert.rs
E810SEXPR-ROUNDRound-trip validation failuretests/sexpr_roundtrip_tests.rs
E811EVAL-DEPTHEvaluation depth exceeds MAX_EVAL_DEPTH (32)src/sexpr/eval.rs
E812EVAL-STEPSEvaluation steps exceed MAX_EVAL_STEPS (10000)src/sexpr/eval.rs
E813EVAL-UNDEFUndefined symbol in evaluationsrc/sexpr/eval.rs
E814MACRO-HYGIENEMacro hygiene violation / expansion depth exceededsrc/sexpr/macro_expand.rs
E815READER-UNKNOWNUnknown reader macrosrc/sexpr/reader.rs

Removed Variants

Warning

The LexicalError and TemporalCausalityViolation variants were removed. If your tooling matches on these variants, update to use ParseError and remove the causality match arm.

The following variants were removed as dead code (never constructed):

  • LexicalError — lexer errors are correctly classified under ParseError (E1xx).
  • TemporalCausalityViolation — forward-declared for planned causality analysis; never implemented.

Diagnostic Rendering (ERR-001)

The Diagnostic struct in src/diagnostic.rs provides rustc-style error rendering with:

  • Source line snippets with line numbers
  • Caret indicators (^^^) pointing to the exact span
  • Note and help labels for additional context
  • "Did you mean?" suggestions via Levenshtein distance (src/suggest.rs)
  • "First defined here" notes for duplicate-name errors

CLI errors are rendered through render_diagnostic() in mirr-compile. LSP diagnostics are converted via MirrError::to_diagnostic().


See Also

E9xx — SAT Simplification

CodeMessageTrigger
E900SAT errorGeneral SAT simplification error (exceeds MAX_SAT_CHECKS or internal failure)