Magento – Magento 2.2.3 – main.CRITICAL Notice: Undefined index: websites

cachemagento2magento2.2.3PHP

I've a strange problem with a project that appeared all of a sudden. When I try to enter the site I get this error:

An error has happened during application run. See exception log for details.
enter code here

When I look in the exception.log:

[2018-03-26 15:15:12] main.CRITICAL: Notice: Undefined index: websites in /var/www/project/www/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/project/www/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/project/www/vendor/magento/framework/App/ErrorHandler.php:61)"} []

This error came out of nowhere and the site is not working. Neither frontend or backend/admin. As you can see it's something related to the cache handling in a core file. I've been struggling for hours with this issue and I'm out of ideas…

I've tried:

  • Developer mode
  • Cleaing/flushing cache
  • Disabled cache
  • Removing www/pub/static/frontend/ www/pub/static/_requirejs/ www/var/cache/ www/var/di/ www/var/generation/ www/var/page_cache/ www/var/view_preprocessed/ www/generated/ from disk.
  • Restored database dump from yesterday
  • Removed www/vendor folder and re-ran composer install and composer update
  • Re-installed Magento with the setup CLI command
  • Re-created www/app/etc/env.php to make sure it's not corrupted
  • Turned off opcache in php.ini

I'm using Magento 2.2.3 with Nginx, MySQL and Ubuntu 16.04. I'm not using redis or varnish.

The Magento CLI is working and no exceptions are thrown.

Any ideas guys?

Best Answer

To me it was solved when I ran:

php bin/magento setup:di:compile