diff --git a/src/Drupal/Commands/core/FieldDeleteCommands.php b/src/Drupal/Commands/core/FieldDeleteCommands.php index d818acb8a4..2eb89cb681 100644 --- a/src/Drupal/Commands/core/FieldDeleteCommands.php +++ b/src/Drupal/Commands/core/FieldDeleteCommands.php @@ -81,6 +81,15 @@ public function delete(string $entityType, ?string $bundle = null, array $option 'bundle' => $bundle, ]); + if ($results === []) { + throw new \InvalidArgumentException( + t("Field with name ':fieldName' does not exist on bundle ':bundle'.", [ + ':fieldName' => $fieldName, + ':bundle' => $bundle, + ]) + ); + } + $this->deleteFieldConfig(reset($results)); // Fields are purged on cron. However field module prevents disabling modules