How to solve “There has been an error processing your request”

Problem

Message “There has been an error processing your request. Exception printing is disabled by default for security reasons.” is a very common problem, which usually appear after update (Magento 2 or extension) or changes in templates code.

For security reasons, Magento 2 hides full error message and shows the message above with “Error log record number” reference.

Solution

Before dealing with error, you need to see full error text.

If you have error log record number, you just need to open report file with name, corresponding to this number. All reports are located in folder var/report.

For example, if you have “Error log record number: 756135892816”, then proper report will be [Magento Root Directory]/var/report/756135892816.

In some cases, Magento doesn’t return error log number. In this case you need to temporary switch Magento to Developer mode in file app/bootstrap.php, and add the following lines:

/**
 * Environment initialization
 */
error_reporting(E_ALL);
ini_set('display_errors', 1);
$_SERVER['MAGE_MODE'] = 'developer';

This will make detailed error message displayed with full backtrace and you will be able to resolve the problem.