There are several common errors in Magento that you may encounter when you work with this complicated e-commerce platform. One of them is “There has been an error processing your request, exception printing is disabled by default for security reasons“, which occurs after you have changed or updated something on your Magento website. Full error message is like this:There has been an error processing your request

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

This is an example:

magento exception printing is disabled by default for security reasons

This error message leads us to nowhere, we don’t know what is the cause of the error and can’t figure out how to fix it.

In this tutorial, I will explain the cause of this error and provide you with step by step how to debug and fix this error for both Magento 1.9.x and Magento 2.x.

Cause of the error

This error usually happens when you install Magento or upgrade Magento version. You will also see this error when installing new components to Magento site, such as Magento themes, Magento extensions.

There were something wrong with the system like wrong database configuration, wrong cache folder path which makes Magento failed to decide where to put cache files.

How to debug the error

By default, Magento does not show the error details due to security reason. This is good to protect your website from unwanted hacks, however, this makes web owner hard to find out which caused the error.

Now we will enable exception printing to display error massage on your website to find out error cause and fix it.

Display error in Magento 1.9.x

To display error massage right on your website in Magento 1.9,x, follow these steps:

Step 1: Use a file manager app like Winscp, Filezilla to access your Magento website’s files.

magento installation folder

Step 2: Navigate to [Magento-installation-folder]/errors/local.xml.sample  and rename it to local.xml.

local xml file

By doing this trick, the error will be displayed right on your website and we will be able to fix it by reading the error log details. If you did everything properly, now you will see such page on your website rather than exception printing is disabled by default for security reasons

detail magento error message

Display error in Magento 2.x

In magento 2.x, things are similar.

Step 1: Open file manager of your hosting, navigate to pub/errors/ folder

magento 2 pub folder

Step 2: Look for local.xml.sample and rename it to local.xml

rename local xml file

Now reload your error page, and you will see a full error message page like this

error message magento 2

After the error page returns a detailed error message, we can start digging out what caused the error and find a way to fix it. I will list out several error types I usually encounter when working with Magento and solution to each.

Solution for Magento 1.9.x

Could not determine temp directory, please specify a cache_dir manually

When you see this error message, you will need to define a cache folder for your Magento site.

Open file manager and go to /lib/Zend/Cache/Backend/File.php, in line 99 find ‘cache_dir’ => null, and change it to ‘cache_dir’ => ‘tmp/’,

Finally, save your file, clear cache and refresh the page to see if the error is gone.

[2002] Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

You will see this error when there’s wrong MYSQL configuration in your Database configuration file.

Go to database configuration file located in <Magento installation folder>/app/etc/local.xml. Open it with a file editor and look for the following credentials in line 42

Recheck if the following lines are correct with your database configuration and change them accordingly

  • Database username: <username><![CDATA[root]]></username>
  • Database password: <password><![CDATA[123456#]]></password>
  • Database name: <dbname><![CDATA[magento]]></dbname>

Invalid method Mage_Catalog_Block_Product_View_Type_Simple

This error normally occur when there’s something wrong with your Magento theme, try to contact theme provider or reupload the theme to Magento folder to solve this issue

Theme files are located in

  • /app/design/frontend/default/TEMPLATE/layout/
  • /app/design/frontend/default/TEMPLATE
  • /skin/frontend/default/TEMPLATE

Missing locale file ‘/public_html/includes/src/Data/en_US.xml’ for ‘en_US’

Go to includes/config.php and commend the following lines

Save the file, clear cache and refresh page to see if the error is gone.

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;

This error is related to database corruption. You may need to repair database or reimport database to make your site work again

Controller file was loaded but class does not exist

This error means there was invalid controller class name or wrong controller file path.
Make sure controller is named as Packagename_Module_ControllernameController and located in app/code/local/Packagename/Modulename/controllers/ControllernameController.php

Solution for Magento 2.x

Recoverable Error: Argument 1 passed to

Try to delete var/generation in your Magento 2 installation folder. Also, make sure context must be passed as first argument in your code, you can find a similar solution to your issue here

Warning: SessionHandler::read(): open

You will see this error during installation of Magento 2, Refer a solution to this error here

Mage registry key “_singleton/extensionname/observer” already exists”

This happen when there are conflics between themes/plugins on your site with the extension mentioned in the error message. Try to disable or reinstall the extensions and clear cache to fix this issue. If it won’t work, try to contact your extension provider.

Could not determine temp directory, please specify a cache_dir manually

Similarly to Magento 1, we will need to specify a cache_dir for Magento to store caching files. We will change this in your site’s .htaccess file located in Magento 2 root folder.

Add the following lines to your .htaccess file

Save changes and reload your site.


There are much more errors message that I have never encountered, please support the Magento community by dropping a comment bellow describe your error and solution if possible. Feel free to let me know if you have any suggestion or questions to this tutorial.

Happy coding!