Skip to content
Errors

Errors

From the compiler

The compiler stops at the first error, writes it to standard error, writes no executable, and exits with status 1. An error is one line.

file.qdx:2:7: error: right operand must be int but is bool

The numbers are the line and the column, both counted from 1.

Reading the source

MessageMeaning
unexpected character '@'The character is not part of the language.
a number cannot be followed directly by a letterSomething like 12abc.
number 99999999999999999999 does not fit in 64 bitsThe literal is too large for int.
a bytes literal must end on the line it starts onThe closing quote is missing.
unknown escape '\q'A backslash in a bytes literal is followed by something other than n, t, \, " or x.
\x must be followed by two hexadecimal digits (0-9, A-F)A hexadecimal escape is incomplete or uses lowercase letters.
expected ')' but found name 'x'The compiler needed one thing and met another. The first part is what it needed.
'if' needs an 'else' branch, because it produces a valueAn if has no else.
a block must end with a result expressionA block is empty or ends with a let.
unknown type 'float' (known types: ...)A type name is neither built in nor declared.

Names

MessageMeaning
'point' is already a recordA top-level name is declared twice. The ending says what holds it: a record, a union, a union case, a function, a built-in function or a built-in type.
field 'x' of 'point' is declared more than onceA record or a union case repeats a field name.
parameter 'a' of 'add' is declared more than onceA function repeats a parameter name.
unknown name 'y'No let, parameter or pattern has introduced that name here.
unknown function 'missing'A call names no function, record or union case.
unknown record or union case 'nothing'A value is made with named fields, but nothing with that name is declared.
no 'main' function (expected: fn main() -> int)The program has no main. This message has no position.
'main' must take no parameters and return intmain is declared in another form.

Types

MessageMeaning
left operand must be int but is boolAn operator was given the wrong type. Also reported for the right operand.
operand of 'not' must be bool but is intThe same, for not and for - before a value.
values of type 'point' cannot be compared with '==' or '!='== and != work only on int and bool.
condition of 'if' must be bool but is int
'else' branch must be int but is boolThe branches of an if produce different types. The type named first is the one the first branch produced.
value of 'n' must be int but is boolA let with a type was given a value of another type.
result of 'area' must be int but is boolA function body does not produce the declared result type.
'add' takes 2 argument(s) but was given 1
argument of 'twice' must be int but is bool

Records and unions

MessageMeaning
fields of 'point' must be named, as in point(field: value)A record or union case was made with unnamed values.
'point' takes fields (x, y) in that orderThe names are missing, extra, or in another order.
field 'x' of 'point' must be int but is bool
record 'point' has no field 'z'
only records have fields, but this is intA dot was used on something that is not a record.
only unions can be matched, but this is int
'circle' is not a case of 'light'A match arm names a case of another union, or no case at all.
case 'red' is matched more than once
match on 'light' is missing: blueLists every case without an arm.
'pair' has 2 field(s) but the pattern names 1A pattern must give one name per field.
pattern names 'a' more than once
'green' arm must be int but is boolThe arms of a match produce different types.

From a running program

A program that stops because of an error writes one line to standard error and exits with status 1.

MessageCause
file.qdx:1:48: error: division by zero/ or % with a divisor of zero. The position is the operator in the source.
Any text without a positionA call to panic, from your code or the library. The library’s messages start with the function’s name, as in slice: range is outside the bytes.

Two mistakes end a program without a message, because the operating system stops it first: a call chain deep enough to run out of stack, and a raw_ function given a wrong address.