Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

YLang compiler error codes

YLang diagnostics include stable codes to help users search documentation and report bugs. Wording can improve between releases; documented meanings should remain stable.

Lexing and parsing

CodeMeaningWhat to do
E1003An expression was expected but the current token cannot start one.Check the preceding operator and use a supported expression.
E1015print() has no arguments.Pass at least one value, such as print("");.
E1016Unknown standard-library namespace.Use a documented namespace such as math, string, io, path, or image.
E1017Expression nesting exceeds the parser’s supported depth.Simplify deeply nested parentheses, unary operators, or call/index expressions.
E1020Malformed import declaration or path.Use from "./module.yl" import name;.
E1022Imported source file could not be resolved or read.Check the path relative to the importing file.
E1023Circular module dependency.Break the import cycle.
E1024Imported function or global does not exist.Check the target module declarations and spelling.
E1025Imported name is duplicated, ambiguous, or conflicts with a local declaration.Import each name once and avoid local name conflicts.
E1026An imported module defines or imports the program entry point.Keep main() in the root program file.

Types, names, and expressions

CodeMeaningWhat to do
E2001Assignment or initializer type mismatch.Match the declared type or use an explicit conversion.
E2002Unknown type name.Use a declared or built-in type.
E2004Duplicate name in one scope.Rename or remove the duplicate declaration.
E2005void used in a value position.Use a value type, or remove the value where appropriate.
E2010Integer literal is outside the signed 64-bit range.Use a representable integer.
E2011Floating-point literal is invalid or out of range.Use a finite float literal.
E2012Character literal is not one byte.Use one ASCII byte or an escape.
E2014Function calls or assignments appear in an f-string interpolation.Compute the value before interpolating it.
E2020Unknown variable name.Declare the variable or correct its spelling.
E2021Variable may be read before initialization.Assign it on every control-flow path before reading it.
E2022Assignment to a const variable.Keep constants immutable.
E2023Assignment used as a nested value expression.Keep assignment as a statement.
E2027Invalid array operation or indexing target.Index a supported array with an integer index.
E2029An array is used as a value without an index.Index the array or pass it to a function parameter that explicitly accepts an array.
E2030Unary minus used with a non-numeric value.Negate an int or float.
E2031Logical negation used with a non-boolean value.Use a bool expression.
E2032Logical operators require boolean operands.Use boolean expressions on both sides.
E2034Numeric operation uses incompatible operand types.Convert explicitly so the numeric types match.
E2035Ordered comparison uses incompatible types.Compare matching numbers, chars, or strings.
E2036Equality operands are incompatible or are unsupported struct values.Compare matching comparable values; struct equality is not implemented.
E2040Unknown function name.Check spelling or define the function.
E2041Wrong number of user-defined function arguments.Match the function’s declared parameter count.
E2042Function argument type mismatch.Match each argument to the expected type.
E2043Duplicate function definition in one module.Keep one definition per function name in a module.
E2044A string standard-library function received a non-string argument.Pass strings.
E2045An explicit conversion received an unsupported source type.Check the conversion function’s accepted input type.
E2050print received a void expression.Print a value, or change the function to return one.
E2051An if, while, or for condition is not boolean.Use a boolean expression.
E2052break or continue appears outside a loop.Place it inside a loop.
E2053A non-void function return omits a value.Return a value of the declared type.
E2054A void function returns a value.Use return; or change the return type.
E2055Function return type mismatch.Return the declared type.
E2056Global initializer is not a constant expression.Use a constant initializer or initialize inside a function.
E2057match does not receive a user-defined enum.Match a declared enum value.
E2058A match arm uses a different enum type.Use variants from the matched enum.
E2059Duplicate enum variant in a match.Keep one arm per enum variant.
E2060Program has no main() function.Define the program entry point.
E2061Invalid main() signature.Use no parameters and return int or void.
E2062A non-void function path can end without returning.Return a value on every supported path.
E2063Enum match is not exhaustive.Add an arm for every variant.
E2064match input contains a call or assignment.Store the value in a variable before matching.
E2070A struct declaration conflicts with an existing struct or enum name.Choose a unique name for the struct.
E2071Duplicate struct field name.Use a unique field name.
E2072Unsupported struct field type.Use a field type supported by the experimental struct feature.
E2073Struct has no supported fields.Add at least one supported field.
E2074Wrong number of struct constructor arguments.Pass one value per field.
E2075Struct field initializer type mismatch.Match arguments to declared field types.
E2076Member access target is not a struct.Access a field on a value of a declared struct type.
E2077Unknown struct field.Correct the field name or declaration.
E2078Unsupported struct assignment target.Assign to a supported named struct variable’s field.
E2079Direct printing of struct values is unsupported.Print individual fields.
E2080Unknown variant for an enum type.Use a variant declared by that enum.
E2081Duplicate enum type name in a module.Use a unique enum name.
E2082Duplicate variant in an enum declaration.Declare each variant only once.
E2083Empty enum declaration.Declare at least one variant.
E2084A match arm does not name an enum variant.Write a valid enum variant in every arm.
E2085Wrong number of GUI function arguments.Follow the GUI function’s documented signature.
E2086Conversion function received the wrong number of arguments.Pass exactly one argument.
E2087length received the wrong number of arguments.Pass one array argument.
E2088Standard-library function received the wrong number of arguments.Follow the function’s documented signature.
E2089Unknown GUI function.Check the GUI namespace API documentation.
E2090GUI function argument type mismatch.Pass values of the types required by the GUI API.
E2091Direct printing of enum values is unsupported.Compare variants and print a string label.
E2092Assignment target is unknown or unsupported.Assign to a declared mutable variable, array element, or supported struct field.
E2093Increment operator has an invalid target.Use ++ on a mutable numeric variable or supported struct field.
E2094Function parameter expects an array argument.Pass a declared array variable of the expected element type.
E2095+= target is not an int or float.Use += only with numeric variables or fields.
E2096length received a non-array value.Pass a declared array to length.
E2097Wrong number of math function arguments.Match the math function’s documented arity.
E2098Math function argument is not a float.Use a float literal or explicitly convert an integer with to_float.
E2099Function array argument has the wrong element type.Pass an array whose element type matches the parameter.

Runtime arithmetic and bounds failures currently use descriptive text rather than compiler error codes. Runtime source line and function attribution are not yet implemented.