Skip to main content

Occasionally, a Drupal site may display a warning about a module being "Missing or invalid." This issue occurs when a module is marked as installed in the configuration but is no longer present in the file system. A common example is the `fakeobjects` module, which is associated with CKEditor 4 and may remain in the configuration after CKEditor 4 is uninstalled. 

 

Understand the issue

The warning occurs because Drupal stores module information in the `core.extension` configuration. If a module is no longer present on the server, it is flagged as "missing." This situation often arises when modules are removed indirectly (e.g., CKEditor 4 uninstalling its plugins).

To clean up the system, the missing module must be removed from the configuration.

 

Export the configuration as a backup (optional)

Before making changes, it is good practice to back up your site's current configuration:

drush config-export
or 
drush cex

This will save your site's configuration files to the `config/sync` directory. This backup allows you to revert changes if needed.

 

Edit core.extension to remove the module

To remove the `fakeobjects` module, you need to edit the `core.extension` configuration where installed modules are listed. There are two approaches:

Using Drush

drush config-edit core.extension

Find and remove the line referencing `fakeobjects` under the `module:` section.

Manually editing the configuration file
1. Open the `core.extension.yml` file in your `config/sync` directory.
2. Locate the `fakeobjects` entry in the `module:` section and delete it.

module:
    fakeobjects: 0

 

Update the database directly (if needed)

If the module still appears as missing after editing the configuration, you may need to update the database:

  1. Access the database using a tool like phpMyAdmin or a command-line client.
  2. Query the `config` table to find the `core.extension` configuration:
    SELECT * FROM config WHERE name = 'core.extension';
  3. Edit the configuration record and remove any references to the `fakeobjects` module.

 

Re-import the updated configuration

Once the changes have been made, re-import the updated configuration to apply them to your site:

drush config-import
or
drush cim

 

Clear the cache

Clear Drupal's cache to ensure the changes take effect:

drush cr

 

Verify the module has been removed

Finally, check that the missing module no longer appears:

drush pm-list --status=missing

If the module is no longer listed, the removal was successful.

 

General tips for handling missing modules

- Always back up your database and configuration before making significant changes.
- Check if other custom modules or themes rely on the missing module before removal.
- Test your site thoroughly after making changes to ensure no functionality has been disrupted.

By following this process, you can cleanly remove any missing module from your Drupal site and avoid configuration warnings. Using `fakeobjects` as an example, this approach ensures your site remains clean and functional after module-related changes.

Related articles

Andrew Fletcher04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...