Fixed: Exception Printing is Disabled by Default for Security Reasons in Magento 2

Fixed: Exception Printing is Disabled by Default for Security Reasons in Magento 2

If you work with Magento 2 themes and modules, you may have encountered the following error notification.

exception-printing-is-disabled-by-default-for-security-reasons.

Let’s see what this notification actually means, what causes it, and how to fix it.

What Does the Notification Mean?

This is an error notification which warns that something is wrong with Magento 2 which is stopping it from operating properly. This usually occurs when installing/updating Magento 2 theme or extension.

Cause of the Error:

The conflict between some components of Magento 2 such as extensions/themes or problem with the cache folder commonly causes this error.

 There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: xxxxxxxx

How to Fix Exception Printing is Disabled by Default for Security Reasons in Magento 2?

There are multiple ways to fix this error.

1. Enable Exception Printing

To fix this problem, you need to enable exception printing errors. The Error log record number: XXXXXXXX as can be seen in the notification error above can be checked by going to /var/log (this is where error log files are generated in Magento 2).

To fix the issue, navigate to folder /pub/errors.

Find the file local.xml.sample and rename it to local.xml in the same folder.

Make sure you are in developer mode. You can switch to development mode using the following command.

php bin/magento deploy:mode:set developer
Dive Deeper: How to Set Magento 2 Developer and Production Mode

2. Flush Cache

Now, Flush Magento 2 Cache.

  • Go to the Admin Panel > System > Cache Management
  • Click the Flush Cache button on right top.

The exception printing error (exception printing is disabled by default for security reasons) is solved. This solution works for all Magento versions (2.1.x, 2.2.x, 2.3.x, 2.4.x).

If you are still getting the error or have any questions, then contact our support team to get an instant solution.