Error codes

Your Adafruit Circuit Playground Express may encounter a situation that prevents it from running your code. The system software that runs the programs on your board may notify you that an error occurred. It will show this error as a binary number displayed on the pixel LEDs. These error numbers are called panic codes. When an error happens that causes a panic code, your program will stop and you’ll need to reset the board to start again.

A panic code is shown as a binary number where each pixel is a binary digit of the error code. A blue pixel means that the digit is 0 and a red pixel is a 1. The first pixel (pixel 0) is the least significant digit of the code. The panic code for PANIC_CODAL_HARDWARE_CONFIGURATION_ERROR is 90, or 0001011010 in binary, so the pixel colors are:

Pixel Color Bit Value
0 blue 0
1 red 1
2 blue 0
3 red 1
4 red 1
5 blue 0
6 red 1
7 blue 0
8 blue 0
9 blue 0


On the board they display like this:

forever(function () {
    light.setAll(0x0000ff)
    light.setPixelColor(1, 0xff0000)
    light.setPixelColor(3, 0xff0000)
    light.setPixelColor(4, 0xff0000)
    light.setPixelColor(6, 0xff0000)
    pause(2000)
    light.clear()
    pause(1000)
})

Panic codes

Some panic codes are for general errors that might occur while your program runs. Other times, a device or resource you want to use isn’t present or isn’t working and you receive a panic code for that. Several panic codes are related to the use of memory and accessing data in it.

  • 20 (PANIC_CODAL_OOM): there is no free memory on the Adafruit Circuit Playground Express
  • 21 (PANIC_GC_OOM): Garbage Collection can’t allocate any more memory
  • 22 (PANIC_GC_TOO_BIG_ALLOCATION): Garbage Collection can’t allocate memory for the requested size
  • 30 (PANIC_CODAL_HEAP_ERROR): a general memory allocation error
  • 40 (PANIC_CODAL_NULL_DEREFERENCE): a memory pointer is NULL and points to an invalid location
  • 50 (PANIC_CODAL_USB_ERROR): USB is not available or can’t initialize, transmit, or receive
  • 90 (PANIC_CODAL_HARDWARE_CONFIGURATION_ERROR): actual board hardware doesn’t match the configuration description
  • 901 (PANIC_INVALID_BINARY_HEADER): the type header for the object is not valid
  • 902 (PANIC_OUT_OF_BOUNDS): the object data portion is greater than the length defined for it
  • 903 (PANIC_REF_DELETED): an object reference was deleted and the object is no longer valid
  • 904 (PANIC_SIZE): the object size doesn’t match the size defined for the type
  • 905 (PANIC_INVALID_VTABLE): an object vtable is invalid or not initialized
  • 906 (PANIC_INTERNAL_ERROR): an internal resource error
  • 907 (PANIC_NO_SUCH_CONFIG): the specified device resource is not present
  • 908 (NO_SUCH_PIN): the specified pin is not present on the board
  • 909 (PANIC_INVALID_ARGUMENT): the argument value is out of range or the type or format is invalid
  • 910 (PANIC_MEMORY_LIMIT_EXCEEDED): insufficient memory is available to satisfy and allocation request
  • 911 (PANIC_SCREEN_ERROR): the screen isn’t present or it can’t properly display the output
  • 912 (PANIC_MISSING_PROPERTY): the property requested is not present in the current object
  • 913 (PANIC_INVALID_IMAGE): the data for a screen image data is invalid or formatted incorrectly
  • 914 (PANIC_CALLED_FROM_ISR): the current code isn’t allowed to run in an interrupt service routine (ISR)
  • 915 (PANIC_HEAP_DUMPED): the contents of memory was output to a debug port
  • 916 (PANIC_STACK_OVERFLOW): stack size limit for the fiber was exceeded
  • 917 (PANIC_BLOCKING_TO_STRING): inline execution blocked due to an existing resume context
  • 918 (PANIC_VM_ERROR): VM execution context error
  • 920 (PANIC_SETTINGS_CLEARED): storage required for system settings, user settings were cleared
  • 921 (PANIC_SETTINGS_OVERLOAD): frequency of writes to settings storage is too high
  • 922 (PANIC_SETTINGS_SECRET_MISSING): settings storage in flash memory is inconsistent
  • 923 (PANIC_DELETE_ON_CLASS): a settings key delete was attempted on a class
  • 924 (PANIC_OUT_OF_TIMERS): no more timers are available
  • 980 (PANIC_CAST_FROM_UNDEFINED): attempted cast from an undefined value to another type
  • 981 (PANIC_CAST_FROM_BOOLEAN): attempted cast from a boolean value to an incompatible type
  • 982 (PANIC_CAST_FROM_NUMBER): attempted cast from a number value to an incompatible type or no conversion is available
  • 983 (PANIC_CAST_FROM_STRING): attempted cast from a string value to an incompatible type or no conversion is available
  • 984 (PANIC_CAST_FROM_OBJECT): attempted cast from an object to an incompatible type
  • 985 (PANIC_CAST_FROM_FUNCTION): attempted cast from a function to a non-function type
  • 989 (PANIC_CAST_FROM_NULL): attempted cast from a null value to another type

See also

panic, assert