When Hades encounters a problem it prints a richly formatted diagnostic that tells you the error type, a human-readable message, the exact source line, and a red caret (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ToberlerOhn/hades/llms.txt
Use this file to discover all available pages before exploring further.
^) pointing to the column where the fault was detected. Errors are separated into two families: syntax errors, which are raised during lexing or parsing before any code runs, and runtime errors, which are raised by the interpreter during execution.
Error Format
Every error follows the same visual structure, produced by thef_error function in helpers.py:
- The header line names the error family (
Syntax ErrororRuntime error). - Error shows the message in bold red.
- Line N is the 1-based line number in your source file.
- The source line is printed underlined so you can identify it at a glance.
- The red
^caret sits directly beneath the offending character.
Syntax Errors
Syntax errors are raised either by the Lexer (during tokenisation) or the Parser (during grammar analysis). The program never starts executing when a syntax error is present.Lexer Errors
Unterminated string literal
Raised when a string opened with
' reaches end-of-file without a closing '.Parser Errors
Expected ';' to terminate the statement
Every statement that is not a block (
{}) must end with a semicolon.Expected '}' to close the block
A block opened with
{ was not closed before a new statement or end of file.Runtime Errors
Runtime errors (InterpreterError) occur during execution. They carry the source token that triggered the fault, so the caret always points to the right place.
Undefined Variable
Raised when you read a variable name that has not been declared in the current scope.Did You Mean?
When the interpreter cannot find a variable it usesdifflib.get_close_matches to search all variables currently in scope and suggest the closest match. The cutoff similarity threshold is 0.6.
Cannot Assign to Undeclared Variable
Raised when you try to assign to a name that was never declared with a type hint.Division by Zero
Raised for both/ and % operations when the right-hand side evaluates to zero.
Invalid Operand Types
Raised when an operator is applied to incompatible types, such as adding a number to a string.List Index Out of Range
Raised when you access an index that does not exist in the list.Type Mismatch
Raised when a value assigned to a typed variable does not match the declared type hint.Function Argument Count Mismatch
Raised when a function is called with the wrong number of arguments.Calling a Non-Callable
Raised when you attempt to call a variable as if it were a function.Cannot Iterate Over Non-List/String
Raised when afor … in loop is given a value that is neither a list nor a str.
Cannot Redefine a Function
Raised when afunc definition uses a name that already exists in the current scope.
Summary Table
| Error | Phase | Common Cause |
|---|---|---|
| Unexpected character | Lexer | Invalid symbol in source (e.g. @, #) |
| Unterminated string literal | Lexer | Missing closing ' |
| Invalid float | Lexer | Multiple decimal points in a number |
Expected ';' | Parser | Missing semicolon at end of statement |
Expected ')' | Parser | Unclosed parenthesis in expression or call |
Expected '}' | Parser | Unclosed block body |
| Unterminated block | Parser | EOF inside a {...} block |
| Undefined variable | Runtime | Variable read before declaration |
| Cannot assign to undeclared | Runtime | Assignment without prior name: type = … declaration |
| Division by zero | Runtime | Divisor evaluates to 0 |
| Invalid operand types | Runtime | Operator used on incompatible types |
| List index out of range | Runtime | Index ≥ len(list) or < -len(list) |
| Type mismatch | Runtime | Value does not match declared type hint |
| Argument count mismatch | Runtime | Wrong number of arguments in function call |
| Not callable | Runtime | () applied to a non-function variable |
| Cannot iterate | Runtime | for … in over a non-list, non-string value |
| Cannot redefine function | Runtime | func declaration with a name already in scope |