Apparently I am lucky, having gone through years of Drupal development without encountering a corrupted database registry. If you encounter a “Failed opening required … “ error then it is possible you've run into the same issue. (click here if your site is on Drupal 8).
Here's the full error message I received:
Drush command terminated abnormally due to an unrecoverable error. [error] Error: require_once(): Failed opening required '/var/www/html/example.com/sites/all/modules/contrib/bean/plugins/base.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/example.com/includes/bootstrap.inc, line 3190
Another possible error you could receive is:
PHP Fatal error: Class 'EntityAPIControllerExportable' not found in ...sites/all/modules/rules/includes/rules.core.inc on line 11
Thankfully the solution is quite easy. It is possible that the Drupal database registry can get corrupted, but all it needs is a rebuild. If you have Drush installed then you can run the following (after backing up your database for safety):
First download the registry rebuild module to your drush folder
drush @none dl registry_rebuild
Clear Drush cache
drush cc drush
Rebuild your site's database registry from your site's folder or via alias
drush rr
or
drush @site-alias rr
Check to see if you can now load your site and get back to building!
If Drush didn't rebuild the registry properly:
You can run the registry rebuild manually. Download the registry rebuild and put it in your sites module folder: download. If your module folder is not set to the default sites/all/modules, or sites/your-multisite-folder/modules, then you will need to edit the registry_rebuild.php file and update the $module_dir variable.
Once you have the module installed you can run the registry rebuild from the console with
php registry_rebuild.php
or you can run it from your browser by going to: http://example.com/sites/all/modules/registry_rebuild/registry_rebuild.php, changing example.com to your site name, and the directory to your custom module folder (if its different from sites/all/modules). For more detailed information you can check out the module page https://www.drupal.org/project/registry_rebuild
Drupal 8 Instructions:
You're in luck! Or out of luck if you have a similar problem and thought you'd find a solution for D8 here (sorry). Drupal 8 has moved nearly all configuration to file storage.
Instead of database registry checks you need to use a versioning sytem. This is not one of those "nice to have" options which you'll install when you have the free time, version control serves as a backup system for your site's code. It is worth the effort, and will increase efficiency while minimizing time to fix incorrect or conflicting code deployments. Check here for a list of options.
Most Drupal sytems use Git, but there are plenty of options to choose from.