How to Fix an error has happened during application run. See exception log for details in Magento 2
Vinh Jacker | 03-17-2025
If you’re seeing the error message “An error has happened during application run. See exception log for details” in Magento 2, it typically means that there’s an issue with the system configuration, file permissions, or a recent change in the code that caused the application to fail. Here’s a step-by-step guide to troubleshoot and resolve the issue.
What Causes the Error?
The error message “An error has happened during application run. See exception log for details” in Magento 2 can be triggered by various issues, including:
- Incorrect file or folder permissions: If the files or directories don’t have the correct permissions, Magento may fail to load resources properly, leading to this error.
- PHP version incompatibility: Magento 2 requires specific versions of PHP to run correctly. Running an unsupported version can cause system errors.
- Corrupted or missing files: Sometimes, after installing or updating modules, files can become corrupted or deleted, which might prevent Magento from running smoothly.
- Cache issues: Outdated or corrupted cache data can interfere with Magento’s ability to load correctly, causing application errors.
- Code compilation issues: If you’ve made code changes or installed a new extension without recompiling, Magento may not be able to process the new code properly.
- Database or configuration issues: Any incorrect configuration settings or database connection problems can trigger the application error.
- New Module or extension conflicts: Installing new modules or extensions can sometimes lead to conflicts with existing code, causing the application to fail.
How to Fix “An error has happened during application run. See exception log for details” in Magento 2
1. Set developer mode
Developer mode is ideal for troubleshooting and development tasks. To view more detailed error messages, switch Magento 2 to developer mode as recommended by the error message.
To enable developer mode:
php bin/magento deploy:mode:set developer
2. Check the logs
Magento stores error logs in the following files:
- var/log/exception.log: Contains detailed exception stack traces.
- var/log/system.log: Contains general application logs.
3. Check file and folder permissions
Improper file and folder permissions can cause Magento to throw errors. Ensure the following permissions:
find var generated pub/static pub/media app/etc -type f -exec chmod 644 {} \;
find var generated pub/static pub/media app/etc -type d -exec chmod 755 {} \;
chmod 644 app/etc/env.php
chmod 644 app/etc/config.php
Clear cache after updating permissions: php bin/magento cache:clean
4. Run Magento setup commands
If the error is related to missing or outdated files in generated/ or var/, regenerate them:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
5. Reindex and clear cache
If the issue is related to data inconsistency, reindex the data:
php bin/magento indexer:reindex
php bin/magento cache:flush
Conclusion
The error message “An error has happened during application run. See exception log for details” in Magento 2 can be frustrating, but with a systematic approach, it is often easy to resolve. By switching to developer mode, reviewing the logs, checking file permissions, and clearing the cache, you can identify and address the root cause of the problem. Ensuring proper setup and regular maintenance can help prevent these errors in the future.
How to resolve: “An error has happened during application run. See exception log for details”
Please open the .htaccess
from the root and comment out the first line:
SetEnv MAGE_MODE developer
If you still get any troubles, find this topic: Exception printing is disabled by default for security reasons Magento 2 ask for help by leaving a comment.