Compiler Errors


When creating your game it's very easy to forget to declare a variable or mis-type a string as a real etc... These errors will be caught by GameMaker Studio 2 as the game is being compiled or run and a window will open with the error given as well as where the error was found. This information will also be shown in the Compiler Error Output, as shown below: Compile Errors

You can click any of the lines of text that are shown and you will be taken directly to the object or script that has thrown the error, and then you can use the information contained within the message to pinpoint exactly where in the object or script the error has occurred. However, sometimes these errors can seem a bit cryptic, so below you can find a complete list of all errors and a brief explanation of what they mean:

No program to compile A previous compile error has caused the compiler parse tree to not be created and thus the compiler has no program data to compile
Fatal Error while compiling [name] - bailing details below This message simply means that some error has been discovered but the compiler cannot place what or where (if this happens consistently you may wish to contact YoYo Games Support and supply the details that the compiler output window shows)
Recursive macro expansion is not supported You have used recursive macros that refer to each other and constantly expand
Unable to find TextureGroup [group] This error is usually only found from trying to run a malformed project file (if this happens consistently you may wish to contact YoYo Games Support and supply the details that the compiler output window shows)
Wrong to convert [value] to number You have tried to convert the given value, for example a string, into a number
Division by 0 You have tried to divide a value by 0
Invalid object id [object ID] used You have tried to access an object using an ID value that is incorrect (see here for info on object IDs)
Unclosed comment (/*) at tend of script You have created a script comment using /* [comment] */ but have not supplied the closing comment tag (see here for more info)
Invalid token You have an invalid character in your game code, which can happen with foreign language characters or Unicode
Number [num] in incorrect format The given number - shown in the error - is not the correct format for the function or operation being performed, for example you supply an integer when a pointer is required (see the section on Data Types for more info)
Unexpected EOF encountered You have reached the end of file unexpectedly while using the File Functions

Unable to Not a string You have tried to use "!" (not) on a string (for more info on strings see here)
Unable to Negate a string You have tried to negate a string, for example "string = -string" (for more info on strings see here)

Wrong number of arguments for function [function] You have supplied too many or too few arguments for the given function
Failed to parse action_execute_script() - incorrect number of arguments received The action Execute Script has too many or too few arguments for the given script being called
Function [function] expects n arguments, a provided A function has been given the wrong number of arguments when a certain number were expected
Unknown function [function] check to see if script is empty A script has been called that the compiler does not recognise (this error is usually thrown by empty script resource references since the compiler will strip out these resources on compile)
Assignment of an empty value (function does not return anything?) You have tried to assign a return value from a script or function when that script or function returns nothing
Unable to find function [function] You have called an unknown function
Calling a function that needs an instance and no instance is available The function or script being called is for acting on an instance, but at the time of running no instances exist
Calling a function that needs an other and no other is available You have used the keyword other outside of the Collision Event or outside of a with statement
Argument naming error, n arguments but no reference found to a You have given a number of arguments to a script, but fail to reference one of them in the script, for example, your script takes three arguments but you only use arguments [0] and [2] (for more information on scripts and arguments see here)
Cannot compare arguments You have tried to compare two different argument types, like a string and a real number (for more information on scripts and arguments see here)
Unknown function or script [functions/script] The compiler does not recognise the function or script being called
Cannot use resource name [resource] as it is not being exported You have tried to access a resource that has not been flagged as part of the project for the platform being compiled to
Cannot use function/script name for a variable, using [functions/script] You have tried to use either a function name or a script name as a variable, for example string = "Hello World"
Cannot use an argument outside a script The built in argument variables can only be used inside a script but you have tried to use them elsewhere (for more information on scripts and arguments see here)
No references to argument[num] but references argument[num] You are using a reference to an argument that does not exist but that could map to another argument (for more information on scripts and arguments see here)
Incorrect number of arguments for accessor You have supplied the wrong number of arguments when using an accessor (for more information on accessors see here)
Wrong type of arguments for /
Wrong type of arguments for div
Wrong type of arguments for mod
Wrong type of arguments for +
Wrong type of arguments for -
Wrong type of arguments for &&
Wrong type of arguments for ||
Wrong type of arguments for ||
Wrong type of arguments for &
Wrong type of arguments for |
Wrong type of arguments for ^
Wrong type of arguments for <<
Wrong type of arguments for >>
You have supplied the wrong type of argument for the expression being evaluated (for more information on expressions see here)

Using uninitialised variable [var] You have tried to use the named variable before it has been initialised (for more information on variables see here)
Variable [var] is write-only You have tried to change the named variable when it cannot be changed (for more information on variables see here)
Unable to find variable named [var] The named variable cannot be found in the current compile (for more information on variables see here)
Malformed variable reference You have tried to reference a variable in the wrong way (for more information on variables see here)
Trying to set a read only variable [var] You have tried to set a variable that is read only (for more information on variables see here)
Cannot redeclare a built in variable You have tried to declare a local variable using the same name as one of the built in variables (for more information on variables see here)
Cannot use resource name for a variable You have use the same name as a resource from the resource tree as a local variable (for more information on variables see here)
[Variable] is read-only You have tried to use a variable that has been flagged as read only (for more information on variables see here)

Cannot set a constant [constant] to a value You have tried to set a constant to a different value
Constant is invalid here You have tried to use a constant somewhere that is not valid for the code being run
Cannot assign to [var] - it's a constant You have tried to assign a new value to the named constant

Array index should not be negative You have tried to access, create, or set an array value using a negative array index (for more info on arrays see here)
Only 1 or 2 dimensional arrays are supported You have tried to create an array that has more that 2 dimensions (GameMaker Studio 2 only has 1D and 2D arrays - for more info on arrays see here)

Malformed Conditional operator You have used an erroneous conditional (ternary) operator or if statement, and not the format [condition] ? [expression1] : [expression2]; (for more information on if and ternary operators see here)
If requires a then statement You have written an if statement and expression to evaluate, but not given any then part to run (for more information on if see here)
malformed assignment statement In the code you are using an assignment operator wrong (for more information on assignments see here)
Malformed if statement
Malformed repeat statement
Malformed while statement
Malformed do statement
Malformed for statement
Malformed with statement
Malformed switch statement
Malformed break statement
Malformed continue statement
Malformed exit statement
The structure of the given statement is incorrect. For specific details please see the relevant section here: GML Overview
Malformed post inc or dec statement You have tried to use [var]++ or [var]-- in an illegal way (for more information on ++/-- see here)
Malformed pre inc or dec statement You have tried to use ++[var] or --[var] in an illegal way (for more information on ++/-- see here)
Malformed global gml_pragma You have created a wrong global string when using gml_pragma (for more information on gml_pragma see here)
Malformed PNGCrush gml_pragma You have created a wrong string command for PNGCrush when using gml_pragma (for more information on gml_pragma see here)
Malformed Texgroup.Scale gml_pragma You have create a wrong global string when using gml_pragma (for more information on gml_pragma see here)

Default cannot be used multiple times in a switch In your switch statement you have defined default: more than once (for more information on switch see here)
Clause expression type mismatch (clause expressions should all be the same type) In your switch you are checking for two different constant case types, for example a string in one case and an integer in another (for more information on switch see here)
Case argument should be a constant You have tried to use a value that does not evaluate to a constant within one of your switch cases (for more information on switch see here)
Statement in a switch MUST appear after case or default You have added a statement to a switch outside of either a case: or default: call (for more information on switch see here)
Duplicate case statement found / original here You have used the same case constant in two different places within a switch (note that the "original here" comment will be on another line and can be clicked to show the original case:, and you can find more information on switch here)

No return value from expression (does expression have a return value?) You have tried to assign a return value from an expression to a variable when the expression returns nothing (for more information on expressions see here)
Expecting expression after the '.' You have used the point (".") notation erroneously and not added an expression afterwords correctly (for more information on expressions see here)
Unexpected symbol [symbol] in expression The expression uses a symbol that is not part of the accepted expression symbol set - the symbol in question will be shown (for more information on expressions see here)

Unknown Pre operator You have tried to use a symbol as a pre-operator when that symbol is not permitted, for example **[var] or >>[var] - only ++ and -- are acceptable (for more information on ++/-- see here)
Unknown Post operator You have tried to use a symbol as a post-operator when that symbol is not permitted, for example [var]** or [var]>> - only ++ and -- are acceptable (for more information on ++/-- see here)
Unknown pragma [gml_pragma string] You have used a pragma string that is unknown to the compiler (for more information on gml_pragma see here)
Unknown unary operator You have tried to use an unknown symbol as a unary operator (see here for accepted symbols)
Unknown binary operator You have tried to use an unknown symbol as a binary operator (see here for accepted symbols)
Unknown operator [operator] You have tried to use an unknown symbol as an operator (the symbol will be shown in the error, and for a list of accepted symbols see here)

Break used without context You have not used break within a switch or a loop or any other permitted structure (see here for more information on break)
Continue used without context You have not used continue within the correct context (see here for more information on continue)
continue statement is not allowed at this point You have used continue within a apart of your code where it is not permitted (see here for more information on continue)

enum num is invalid The enum number is invalid for the enum (see here for more information on Enums)
malformed enum You have no created the enmu correctly (see here for more information on Enums)
enum [enum] has already been defined You have tried to define an enmum using the same name as another previously defined (see here for more information on Enums)
malformed enum entry The enum has an invalid entry (see here for more information on Enums)
enum expression must be an integer constant The enmu entry does no evaluate as an integer constant (see here for more information on Enums)
enum reference [key] does not exist in [enum] You have tried to reference an enum entry using a key that has not previously been defined for that enum (see here for more information on Enums)

Symbol ( expected
Symbol ) expected
Symbol , or ) expected
Symbol { expected
Symbol } expected
Symbol , or } expected
Symbol : expected
Symbol ; expected
Symbol [ expected
symbol ] expected
Symbol , or ] expected
You have not used a required symbol when writing your code (see the section on Expressions or on Language Features for more info)
Expected id or string You have used a value that is not either a layer ID or a layer name - as a string - in one of the Layer Functions
keyword Until expected You have created a do... until loop but neglected to supply an until expression (see here for more info on do... until)
Function name expected You have used something other than a function name in your code where a function should go (see here for more info on using functions)
variable name expected You have supplied a name that is not a variable name where one is expected (see here for more info on variables)
Assignment operator expected You have created an assignment which expects an operator but none has been supplied (see here for more info on assigning values)

Android ARM ToolChain directory [dir] does not exist The link given in the Android Preferences for the ARM toolchain is incorrect and does not exist.
Android MIPS ToolChain directory [dir] does not exist The link given in the Android Preferences for the MIPS toolchain is incorrect and does not exist.
Android x86 ToolChain directory [dir] does not exist The link given in the Android Preferences for the x86 toolchain is incorrect and does not exist.
Android NDK directory [dir] does not exist The link given in the Android Preferences for the Android NDK is incorrect and does not exist.