Magento 2 showing An error has happened during application run. See exception log for details? Here’s how to resolve it with real commands and tips. Our Magento Support Team is always here to help you.

What Triggers “An error has happened during application run. See exception log for details”

When Magento 2 suddenly throws the dreaded message An error has happened during application run. See exception log for details, it can bring your entire store to a standstill. It usually pops up after a fresh install or an upgrade, and unless you know where to look, finding the exact cause can be frustrating.

Instead of wasting hours guessing, let’s go straight into the real reasons and practical ways to resolve this error step-by-step.

An error has happened during the application run. See exception log for details

What Triggers

In most cases, this error comes up due to common issues in your Magento 2 setup. Let’s go through them one by one.

1. PHP Fatal Errors

Syntax issues or any PHP-related error can instantly trigger this message on the frontend.

2. Database Errors

A broken or missing database connection is another major reason. Sometimes it’s as simple as a corrupt table or missing data.

3. Module or Extension Conflicts

If you installed a new module or extension and saw the error right after, it’s likely the cause. Disable the recent addition and recheck.

Other possible causes include:

  • Missing required PHP extensions
  • MySQL service not responding
  • Wrong database connection details
  • Incorrect command used during Magento 2.4 installation
  • Low memory limit or short max_execution_time

How to Resolve An error has happened during application run. See exception log for details

The best approach is to start from the most common fixes and then move deeper.

Run Magento Commands via SSH

Start by running these commands from your Magento root directory. They often fix the issue instantly since most cases happen because Magento code wasn’t compiled properly.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:Deploy -f
chmod -R 777 var/ generated/

If it still shows the same error, move to the next part.

Enable Developer Mode

Switching to developer mode helps Magento display detailed error messages. To enable it, log into your Magento root via SSH and run:

php bin/magento deploy:mode:set developer

Now check the Magento 2 log folders inside your root directory:
var/report/*, var/log/debug.log, var/exception.log, and system.log

These files reveal the real cause behind the message An error has happened during application run. See exception log for details.

If you have any doubt regarding this topic

Chat animation


Switch Developer Mode via .htaccess

If SSH isn’t available, you can force Magento into developer mode through .htaccess:

  • Log into your hosting file manager and open the Magento root folder.
  • Edit the .htaccess file.
  • Uncomment this line (usually line #5):
SetEnv MAGE_MODE developer
Clear Magento Cache

Once developer mode is active, clear the cache to ensure you’re loading the latest changes.

php bin/magento cache:flush

Then reload your store page.

Debugging Common Error Messages

Let’s go through a few sample error messages and what they mean.

MySQL Database Issue

Error Message:

Exception ‘PDOException’ with message ‘SQLSTATE[HY000] [1049] Unknown database ‘magentip’’

This means Magento can’t find or connect to your database. Restart MySQL and double-check credentials in /app/etc/env.php:

service mysql restart

Verify that:

‘host’ => ‘localhost’,
‘dbname’ => ‘magento2dbname’,
‘username’ => ‘db-username’,
‘password’ => ‘dbpassword’,
Deprecated Function Error

Error Message:

main.CRITICAL: Exception: Deprecated Functionality: Function mcrypt_module_open() is deprecated

If you see this, the folder permissions might be incorrect. Run the following to fix permissions:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chown -R www-data:www-data /var/www/yourmagento2folder/
Request Validation Error

Error Message:

main.DEBUG: URI '/' cannot be accessed with HEAD method (Magento\Cms\Controller\Index\Index)

Run the following commands to recompile and refresh everything:

chmod -R 777 var/ generated/
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento c:f
Deprecated PHP Function

Error Message:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls

This usually happens because your PHP version is incompatible. Downgrade or upgrade PHP to a compatible version and retry.

Missing Magento Class

Error Message:

main.CRITICAL: Class Magento\Framework\App\Http\Interceptor does not exist

This often happens when Magento 2.4 runs behind Nginx as a reverse proxy. Update the Nginx configuration to increase the proxy buffer sizes.

Add the following inside your Nginx server block:

server {
...
location / {
proxy_pass http://192.168.1.99;
...
proxy_buffers 256 8k;
proxy_buffer_size 512k;
proxy_busy_buffers_size 512k;
}
...
}
Check Exception Logs

If you still see “An error has happened during application run. See exception log for details”, check var/log/exception.log. It provides detailed insights into what’s breaking your store.

Clean and Reindex Magento

If nothing else works, try running the following commands to reset everything:

php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
sudo chmod -R 777 var/ generated/ pub/

If the problem still continues, investigate the file Swissup\Core\Observer\Backend\FetchNotifications. The error may originate there.

Finally, run these commands again to make sure the cache is cleared:

sudo php bin/magento cache:clean
sudo php bin/magento cache:flush

[If needed, Our team is available 24/7 for additional assistance.]

Conclusion

The An error has happened during application run. See exception log for details message can look intimidating, but it always points to something fixable—be it code compilation, database credentials, PHP version, or module conflict.

Always enable developer mode first. It shows what’s wrong rather than leaving you in the dark. Then work through the cache, database, and permission checks.

Ignoring this error can lead to more performance issues across both the frontend and backend. So, take time to resolve it properly. And if you’re still stuck, don’t hesitate to reach out to a Magento expert before the issue worsens.