Error: Call to a member function setAccessClass() on null in EntityHooks.php
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3570177. -->
Reported by: [robloach](https://www.drupal.org/user/61114)
Related to !18
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>I'm unsure how I got this, but attempting to uninstall the Modeler API module, it's possible to get a `null` passed into the entityTypeBuild() function.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ol>
<li>Drupal CMS latest</li>
<li>Uninstall all dependencies of the Modeler API</li>
<li>Uninstall Modeler API</li>
<li>Get a PHP error</li>
</ol>
<pre>Error: Call to a member function setListBuilderClass() on null in /modeler_api/src/Hook/EntityHooks.php on line 70 #0 /web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(118): Drupal\modeler_api\Hook\EntityHooks->entityTypeBuild()<br>#1 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(340): Drupal\Core\Entity\EntityTypeManager->Drupal\Core\Entity\{closure}()<br>#2 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(117): Drupal\Core\Extension\ModuleHandler->invokeAllWith()<br>#3 /var/www/html/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(216): Drupal\Core\Entity\EntityTypeManager->findDefinitions()<br>#4 /var/www/html/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(25): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()<br>#5 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(132): Drupal\Core\Plugin\DefaultPluginManager->getDefinition()<br>#6 /var/www/html/web/modules/contrib/eca/src/PluginManager/Action.php(100): Drupal\Core\Entity\EntityTypeManager->getDefinition()<br>#7 /var/www/html/web/core/lib/Drupal/Core/Action/ActionManager.php(38): Drupal\eca\PluginManager\Action->setCacheBackend()<br>#8 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\Core\Action\ActionManager->__construct()<br>#9 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Check to make sure the $type exists before running that block.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Review and merge.</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>None</p>
<h3 id="summary-api-changes">API changes</h3>
<p>None</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>None</p>
issue