--- a/src/Plugin/views/field/SearchApiFieldTrait.php
+++ b/src/Plugin/views/field/SearchApiFieldTrait.php
@@ -787,14 +787,14 @@ trait SearchApiFieldTrait {
               $definition = $typed_data->getTargetDefinition();
               if ($definition instanceof EntityDataDefinitionInterface) {
                 $entity_type_id = $definition->getEntityTypeId();
-                $entity_type = $this->getEntityTypeManager()
-                  ->getDefinition($entity_type_id);
-                if ($entity_type->isStaticallyCacheable()) {
-                  $entity_id = $typed_data->getTargetIdentifier();
-                  if ($entity_id) {
-                    $entities_to_load[$entity_type_id][$entity_id] = $entity_id;
-                  }
-                }
+                if ($entity_type_id && ($entity_type = $this->getEntityTypeManager()->getDefinition($entity_type_id, FALSE))) {
+                  if ($entity_type->isStaticallyCacheable()) {
+                    $entity_id = $typed_data->getTargetIdentifier();
+                    if ($entity_id) {
+                      $entities_to_load[$entity_type_id][$entity_id] = $entity_id;
+                    }
+                  }
+                }
               }
             }
           }
--- a/src/Utility/FieldsHelper.php
+++ b/src/Utility/FieldsHelper.php
@@ -401,6 +401,9 @@ class FieldsHelper implements FieldsHelperInterface {
    * {@inheritdoc}
    */
   public function isContentEntityType($entity_type_id) {
+    if (!$entity_type_id) {
+      return FALSE;
+    }
     try {
       $definition = $this->entityTypeManager->getDefinition($entity_type_id);
       return $definition->entityClassImplements(ContentEntityInterface::class);
--- a/src/Plugin/search_api/datasource/ContentEntity.php
+++ b/src/Plugin/search_api/datasource/ContentEntity.php
@@ -1272,9 +1272,12 @@ class ContentEntity extends DatasourcePluginBase implements ContentEntityDatasou
     if ($property instanceof EntityDataDefinitionInterface) {
-      $entity_type_definition = $this->getEntityTypeManager()
-        ->getDefinition($property->getEntityTypeId());
-      if ($entity_type_definition) {
-        $module = $entity_type_definition->getProvider();
-        $dependencies->addDependency('module', $module);
+      $entity_type_id = $property->getEntityTypeId();
+      if ($entity_type_id) {
+        $entity_type_definition = $this->getEntityTypeManager()
+          ->getDefinition($entity_type_id);
+        if ($entity_type_definition) {
+          $module = $entity_type_definition->getProvider();
+          $dependencies->addDependency('module', $module);
+        }
       }
     }
