Undefined index: name in system requirements

If you Google this error, you will see several different variations of it, each happening on a different line in the system.install file. There are many reasons why you may see this, but in this short article, I will show you how to fix the error in one particular case that happened to me.

The full error (notice) message in my case was:

Notice: Undefined index: name in system_requirements() (line 53 of core/modules/system/system.install).

After I spent some time debugging this error, I found that my core.extension config was missing the profile name in the module list. As you can see in the screenshot below, the last item in the module list is views, and it should be the profile name with the weight of 1000.

Image

If you are using the standard profile, then this cannot happen to you due to the way system_requirements() function works. But, if you are using any other profile, then make sure that you have the profile name listed in the module section like this:

Image

The easiest way to fix this is to use the following function. Either write an update hook and execute it (recommended) or just use the Devel execute page to run this piece of code.

/**
 * Fixes 'Undefined index: name in system_requirements()' error.
 */
function _fix_undefined_index() {
  $config = \Drupal::configFactory()->getEditable('core.extension');
  $installed_profile = $config->get('profile');

  if ($installed_profile) {
    $modules = $config->get('module');
    if (!isset($modules[$installed_profile])) {
      $modules[$installed_profile] = '1000';
      $config->set('module', $modules)->save();
    }
  }
}

About the Author

Goran Nikolovski is an experienced web and AI developer skilled in Drupal, React, and React Native. He founded this website and enjoys sharing his knowledge.