Fatal error handler

The nRF Connect SDK provides an implementation of the fatal error handler that overrides Zephyr’s default fatal error handling implementation.


The library defines the k_sys_fatal_error_handler() function, which is declared in Zephyr’s fatal error handling API. Its implementation in the nRF Connect SDK is standardized for most samples.


When building for an embedded target, the default behavior of the k_sys_fatal_error_handler() function in case of a fatal error is to reboot the application. You can modify the default behavior of the library not to reboot the application. To have the application enter an endless loop, change the CONFIG_RESET_ON_FATAL_ERROR Kconfig option to n.

Library files

This library can be found under lib/fatal_error/ in the nRF Connect SDK folder structure. The Zephyr file it overrides is fatal.c under zephyr/kernel/ in the nRF Connect SDK folder structure.

API documentation


This library is an implementation of Zephyr’s fatal error handling API and does not have a separate API documentation in the nRF Connect SDK.

Header file: zephyr/include/fatal.h
Source file: lib/fatal_error/fatal_error.c