3

I get this error on my site

Drupal\Core\Extension\Exception\UnknownExtensionException: The module does not exist or is not installed. in Drupal\Core\Extension\ExtensionList->getExtensionInfo() (line 346 of ...core/lib/Drupal/Core/Extension/ExtensionList.php).

This error is happening in shared hosting server.

  public function getExtensionInfo($extension_name) {
$all_info = $this->getAllInstalledInfo();
if (isset($all_info[$extension_name])) {
  return $all_info[$extension_name];
}
throw new UnknownExtensionException("The {$this->type} $extension_name does not exist or is not installed."); // line 346

}

I have been searching online and found lot of discussions but I could not fix it. How can I fix the error?

Php: 7.0 Drupal: 8

1
  • 1
    It is obvious that the extension name is an empty string. You need a full error message with stack trace to find out which code is calling the method with a null string. It's unlikely it's a bug in the code itself, but it could point you to the database or config entry which contains the null string.
    – 4uk4
    Apr 6, 2020 at 18:49

2 Answers 2

2

I have agree with @4k4 you can fix this with database

If your module have been deleted from the system use this query

delete from `key_value` where collection = 'system.schema' and name = '$extension_name';

for example:

delete from `key_value` where collection = 'system.schema' and name = 'config_tools';
delete from `key_value` where collection = 'system.schema' and name = 'git_config';
3
  • How am I supposed to know what to delete? I do a select * and everything looks ok, it seems to me my issue is something else Mar 14 at 19:45
  • @JonWeinraub from 4k4 comment - You need a full error message with stack trace to find out which code is calling the method with a null string. In my case i have made additional debug to get module name and than run this commands
    – Alex
    Mar 15 at 7:31
  • all the text afterwards is too long for a comment so i suspect I should ask my own question but don't want it flagged for duplicate Mar 18 at 14:33
7

I had the error still appearing no matter what.

Drupal\Core\Extension\Exception\UnknownExtensionException: The module twig_food does not exist.

Finaly i found this command working:

drush cdel core.extension module.twig_food
1
  • This is a different issue. OP's issue has no module name.
    – Christian
    Apr 27, 2023 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.