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

The reason that Magento 2 is one of the most widely used eCommerce platforms is because of its security. Compared to other platforms, it employs advanced security techniques, thereby protecting the store against common and evolving threats. One of the measures that the platform adopts to protect users to disable exception printing by default. When disabled, you may have encountered the following error notification when working with a theme or module:


This article will first explain this error, address the common causes behind it, and then help you resolve the error.

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. You may have noticed that the error itself is vague and does not provide any specific information related to the error. This is done on purpose so as to protect the store’s sensitive information.

Causes of the “Exception Printing is Disabled by Default for Security Reasons” Error

There are several causes which can lead to this error popping up on your screen, including:

1. Third Party Extensions

No doubt that Magento’s customisability is one of the many reasons contributing to its popularity. However, third party extensions can cause problems in your store’s smooth functioning. When you install an incompatible extension or one that is full of coding issues, you will encounter the “there has been an error processing your request exception printing is disabled by default for security reasons” error.

2. File Permission Issues

Similarly, if there file permission and ownership issues, Magento cannot function properly.

Quick Read: “[Fixed] Magento 2: You Don't Have Permission to Access / on this Server"

3. Coding Issues

The conflict between some components of Magento 2 such as extensions or themes can lead to the error.

4. Caching Problems

Every website relies on cache to boost performance. Your Magento 2 store is no exception to this rule. If the cache file is corrupted, you can encounter this problem.

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

There are multiple ways to fix this error.

Method 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

Method 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.