PHP Fatal error: entity type does not exist

If you somehow get into this nasty problem, you have probably made some big mistake and now you are missing entity definition in your database. To quickly fix that you need to recreate it, you can use drush for it.  So if you are lucky find in code where this entity was added, probably in some hook_update in module.install file 

  \Drupal::entityTypeManager()->clearCachedDefinitions();
  \Drupal::entityDefinitionUpdateManager()
    ->installEntityType(\Drupal::entityTypeManager()->getDefinition('my_custom_entity'));

if not, you can add it yourself like above, just find proper entity key and replace it and run via drush as "drush ev" command and you will be set.