Magento 2E-CommerceHow To GuideMarch 26, 2024Simon Walker

[Solved] An error has happened during application run. See exception log for details Magento 2

[Solved] An error has happened during application run. See exception log for details Magento 2

If you wish to set up a fully customised eCommerce store, Magento 2 is the most obvious option. The problem with Magento 2 is the steep learning curve. You need a fair bit of programming knowledge to realise its full potential. Even if you are a Magento development expert, you are likely to encounter a wide range of issues.

One such issue is mentioned in the title.

There’s nothing to worry about as there exists a solution for every Magento error. This one is no exception. The error “An error has happened during application run. See exception log for details. Could not write error message to log. Please use developer mode to see the message” is one of the most common Magento 2 errors.

What Causes the Error?

It is difficult to pinpoint the root cause of the error unless a Magento expert has access to your store. However, the above error mostly occurs after a fresh Magento install or an upgrade. The most likely causes for exception log Magento 2 error are:

1. PHP Fatal Errors

Syntax errors or any other PHP errors can result in the above error appearing on the screen.

2. Database Errors

If there are issues in the database connection, you are likely to encounter the above issue. For example, the issue could be a corrupt table or a missing data.

3. Module/Extensions

If you recently installed a module/extension and started seeing this error, then you already have the culprit. It is likely that the new module is in conflict with the existing ones. Try disabling it to see if it fixes the error.

Regardless of what causes the error, the emphasis must be on fixing it. Let’s discuss the different ways to resolve this error.

How To Fix “An Error Has Happened During Application Run. See Exception Log For Details”

Either of the following solutions will solve the error in Magento 2.

1. Set Developer Mode

Developer mode is perfect for debugging and development. As stated in the error, Set Magento 2 developer mode to see the message. To set developer mode,

  • Log into Magento 2 root via SSH/CLI
  • Enter the following command:
php bin/magento deploy:mode:set developer

You should also check your Magento 2 error folder in Magento root var folder (var/report/*, var/log/debug.log, var/exception.log and system.log)

2. Switch to Developer Mode via .htaccess

In case you can’t access your Magento 2 root directory via SSH/CLI, you can forcibly switch to developer mode via .htaccess. Here is what you need to do.

  • Log in and navigate to the root of your store.
  • Open .htaccess file for editing.
  • Uncomment the following line (usually line #5):
SetEnv MAGE_MODE developer

3. Flush Cache

To flush Magento 2 cache, go to Magento 2 root directory and run the following command to clear the cache. Try reloading the page when you are done.

php bin/magento cache:flush


If you still need any help to fix this error, feel free to contact our support team. Ignoring the issue can cause performance issues on the back and front-ends. Therefore, try to resolve it right away.