I have this error in my Apache logs, when I try to install any (official) module. 

[Thu May 16 12:20:01.283171 2019] [php7:notice] [pid 24843] Uncaught PHP Exception Drupal\\Core\\Extension\\Exception\\UnknownExtensionException: "The module hello does not exist." at /var/www/html/core/lib/Drupal/Core/Extension/ExtensionList.php line 522, referer: /admin/modules

That "hello" module in the error was a simple test that I made, following a guide, but it has been uninstalled and also removed from the filesystem. Also, the caches were emptied. So, why is it still looking for that?

Comments

mmjvb’s picture

removing that module. Since it already was removed from the filesystem, suggest to remove it from the database as well.

Use SQL:delete from `key_value` where collection = 'system.schema' and name = 'hello'; 

carlo_martini’s picture

That was it. Thanks!

bajah1701’s picture

I did that, updated database, cleared cache and I'm still getting the same error.

Jill L’s picture

I find the cleanest way to fix this issue is to re-download the module's code, and uninstall it (fixing the database issue), and THEN removing the code. This issue comes up when the module code is removed before it's properly uninstalled.

keithn’s picture

Thanks!

mmjvb’s picture

retrieve that module from backup. In order for drupal to recognize it, it needs to be in the same location where is was when enabled. Also, it needs to be the same version as installed. Hopefully, it will uninstall properly.

briangervais’s picture

I executed `composer require drupal/missing-module` to re-download the module's core, then was able to uninstall it and fix my database issue.

yasheshb’s picture

thank you @mmjvb

Yashesh Bhatia

monph’s picture

works like a charm. thanks!

manishdrupaldev’s picture

Using below command, it helped me.

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

Thanks!

majidlahmidi’s picture

it works

nileshkhairnar’s picture

That saves my day. Thanks!

johnhanley’s picture

I mistakenly renamed a custom module without uninstalling it first so this query fixed the aforementioned runtime error. Thank you.

bajah1701’s picture

@Jill, in my case it was a custom module which was already deleted from the file system and the computer as well as the recycle bin. Thankfully it worked after a few hours of ignoring it and doing something else. Don't why it took so long to realize that the module is no longer there.

weynhamz’s picture

Perhaps?

drush cdel core.extension module.MODULE_NAME
Dmytro Litvinchuk’s picture

It works, but after this, I had a problem to install the same module again...

cbfannin’s picture

I had a custom module that I renamed in the middle of development. I had already done everything else and this was the last piece that finally resolved the issue for me, thanks!

samir_mankar’s picture

Thanks this solves my problem.

benjamin_dk’s picture

Yes, this one worked for me too. Thanks.

charder’s picture

Works perfectly!

Tyheman’s picture

drush cdel core.extension theme.THEME_NAME

khurrami’s picture

Thanks it worked

digi_axlot’s picture

It worked!

treckstar’s picture

Thanks, worked perfectly when trying to update a Drupal 9 site to Drupal 10, that had swiftmailer installed.

drush cim

In ExtensionList.php line 524:

  The module swiftmailer does not exist.

drush cdel core.extension module.swiftmailer
drush cim

[success] The configuration was imported successfully.

majidlahmidi’s picture

thanks

garbo’s picture

Yes! Thank you sir!

paulsally’s picture

Deleting the record in key_value also solved my problem! Thanks!!

chethan.thimmaiah’s picture

This worked for me

MykolaVeryha’s picture

$key_value = \Drupal::service('keyvalue');
$key_value->get('system.schema')->delete('hello');
dydave’s picture

Thanks @Mykola Veryha for the code.

I can confirm it helped fixing the issue in my case:

After uninstalling the module properly from the back-end, I enabled devel and executed the code from devel/php.

The error then disappeared and I was able to run updates as expected.

Thanks again for the help!

sumedha’s picture

All the above solutions were perfect but my situation was a bit different. In my case none of the solutions were working, for the reason that it was a contributed module with errors. The error was due to unsupported version and some of my custom code . I was unable to figure out whats going wrong. It was not even getting uninstalled properly.

Then I deleted the module folder completely and run SQL command to delete "key_value" but not luck. I also tried composer install. Still there was an error for the missing module under status report.

Finally I created a new  folder with same module name with a .info.yaml file and uninstalled the module form frontend. Guess what, my website is error free again :)

sanjayk’s picture

Your solution work for me. I was also try to many thing but not luck.

Thanks

shyamkumawat’s picture

This solution actully worked for me, tried multiple things but no result.

rajdattas’s picture

I was getting the same error the module views_current_path does not exist  at /Drupal/Core/Extension/ExtensionList.php line 522. This was happening while installing image captcha sub module from Captcha module. I was missing Views Current Path contributed module to install. After installing this module my error got resolved. You might also be missing some dependency module please check for it.

svetlio’s picture

With drush export config: drush cex

edit core.extension.yml file, delete the row with the module_name, save

then import config: drush cim -y