If the micro:bit runs out of resources or detects a fault, it enters a 'panic' routine which displays a sad face on the micro:bit screen followed by a number eg 020.

In all cases, pressing the reset button on the back of the micro:bit will restart the program, which clears out the RAM memory and starts again.

Here is a list of errors with descriptions of what they mean and what you can do to fix. We also document them all here individually on the support site:

Hardware errors (010-099)

Error number        What this means        
010        The micro:bit's I2C bus is not working. The device might be physically damaged.        
020        There is no free memory on the micro:bit. Your program might be too complex or contain a lot of large variables.          Try reducing your code by making functions out of large sections.        
030        Corruption detected in the micro:bit heap space (memory allocated usually for the storage of variables).          Try flashing a different .hex file to your device        
040        Your micro:bit can't execute your script properly. Flash a different .hex file to it, then try flashing and running your previous script again.        
042        Your micro:bit can't execute your script properly. Flash a different .hex file to it, then try flashing and running your previous script again.        
043        An error occurred with the micro:bit's radio component.        
050        An error occurred with the micro:bit's accelerometer component.        
051        An error occurred with the micro:bit's magnetometer component.        
098        Assertion failed. A MakeCode error that occurs when the condition in an assert was false.

MakeCode Editor errors (800 - 989)


Error codes generated from the MakeCode Editor. In all these cases, please report the error to us, or if you are comfortable using Github, submit an issue on the code repository.

Garbage collector errors

Error number        What this means
840Allocation pointer is null or invalid.
841Garbage collection work queue error.
843VTable entry is not free.
844GC allocation failed for requested number of bytes.
846Invalid allocation thread.
848Allocation pointer beyond allocation header.
849Allocation pointer is null.

Program access errors

Error number        What this means
901The type header for the object is not valid.
902The object data portion is greater than the length defined for it.
903An object reference was deleted and the object is no longer valid.
904The object size doesn’t match the size defined for the type.
905An object vtable is invalid or not initialized.
906An internal resource error.
907The specified device resource is not present.
909The argument value is out of range or the type or format is invalid.

JavaScript runtime codes


These occur for example, when the static type of x is a class c, the dynamic type of x isn’t c, and you try to access a field on x or call a method on x, you will get one of the following codes, depending on dynamic type of x.

Error number        What this means
980When value of x is undefined.
981When value of x is true or false.
982When x is a number.
983When x is a string.
984When x is object of some type.
985When x is a function.
989When x is a null.

If you are using one of the standard languages such as MakeCode or MicroPython, you would not often see these error messages. If you do, please report them to us so we can investigate. 

If you are using C++, then these errors are more likely if you have a bug in your C++ program.

Additional errors (500 - 599)

This error range is also reserved for the micro:bit, so if you see any errrors staring with 5, please report these too.


Keywords for search: sad face, error, error codes, panic code, 020, 042, 050, 051, 847