Drupal 9 or 10 errors after running update.php , or drush updb in Drush:
[warning] Array to string conversion UpdateDBCommands.php:675 [error] (Currently using Missing or invalid module Array)
[warning] Schema information for module menu_per_role was missing from the database. You should manually review th e module updates and your database to check if any updates have been skipped up to, and including, menu_per_role_up date_8104(). [warning] Array to string conversion UpdateDBCommands.php:675 [error] (Currently using Missing or invalid module Array)
In UpdateDBCommands.php line 55: Cancelled.
Possible causes:
- removed module via composer remove drupal/modulename , without uninstalling the module beforehand (e.g. Uninstall from the Modules management interface)
Drush updb looks for the missing module files while it still has database schema and instances in the database, or some configurations somewhere that detects the module as still present and enable - duplicate module copies from two locations – one in /modules/ (where modules installed via browser admin interface are saved), and another copy of the same module in /modules/contrib/ (where modules are saved when installed via composer); and when uninstall or commands are run, for some reason this may cause some issues related to above errors
Fixes:
- reinstate and re-install the module that must have been removed previously in the wrong manner
- from the Extend > Modules interface, uninstall (disable) the module first
/admin/modules/uninstall - then, from Composer (a must!) remove or delete the disabled module using the composer remove /drupal/modulename command to delete it permanently
- do not forget to run drush updb, and drush cache:rebuild after above steps