Cron error due to imcomplete deleted entity

Created on 20 June 2024, about 1 year ago

Problem/Motivation

Here's the bug that's preventing cron running for me:
Error: Call to a member function get() on null in /var/www/html/web/modules/contrib/site_settings/src/Entity/SiteSettingEntity.php on line 344 #0 [internal function]: Drupal\site_settings\Entity\SiteSettingEntity::getDefaultFieldset(Object(Drupal\site_settings\Entity\SiteSettingEntity), Object(Drupal\Core\Field\BaseFieldDefinition))
#1 /var/www/html/web/core/lib/Drupal/Core/Field/BaseFieldDefinition.php(442): call_user_func('Drupal\\site_set...', Object(Drupal\site_settings\Entity\SiteSettingEntity), Object(Drupal\Core\Field\BaseFieldDefinition))
#2 /var/www/html/web/core/lib/Drupal/Core/Field/FieldItemList.php(169): Drupal\Core\Field\BaseFieldDefinition->getDefaultValue(Object(Drupal\site_settings\Entity\SiteSettingEntity))
#3 /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(271): Drupal\Core\Field\FieldItemList->applyDefaultValue()
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(129): Drupal\Core\Entity\ContentEntityStorageBase->initFieldValues(Object(Drupal\site_settings\Entity\SiteSettingEntity), Array)
#5 /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(94): Drupal\Core\Entity\ContentEntityStorageBase->doCreate(Array)
#6 /var/www/html/web/core/modules/field/field.module(288): Drupal\Core\Entity\ContentEntityStorageBase->create(Array)
#7 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1685): _field_create_entity_from_ids(Object(stdClass))
#8 /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(557): Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge(Object(Drupal\field\Entity\FieldConfig), 50)
#9 /var/www/html/web/core/modules/field/field.purge.inc(83): Drupal\Core\Entity\ContentEntityStorageBase->purgeFieldData(Object(Drupal\field\Entity\FieldConfig), 50)
#10 /var/www/html/web/core/modules/field/field.module(169): field_purge_batch(50)
#11 /var/www/html/web/core/lib/Drupal/Core/Cron.php(335): field_cron()

It looks like field_purge_batch is trying to remove fields from an entity type that no longer exists.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States oknate Greater New York City Area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @oknate
  • 🇺🇸United States oknate Greater New York City Area

    Here's a patch that fixes this bug and lets cron run.

  • Status changed to Needs review about 1 year ago
  • 🇺🇸United States oknate Greater New York City Area
  • 🇺🇸United States oknate Greater New York City Area

    Marking ready for review. I don't know if anyone else has this problem, nor how to reproduce.

    We removed a site setting type and it wasn't fully cleaned up.

  • 🇺🇸United States oknate Greater New York City Area
  • Status changed to Needs work about 1 year ago
  • 🇬🇧United Kingdom scott_euser

    Thanks for flagging! Can you create a merge request with your patch please so tests run/coding standards run/etc? Thanks!

  • Status changed to Closed: outdated about 1 year ago
  • 🇬🇧United Kingdom scott_euser

    Anyways this is 8.1 version and the problem no longer exists in 2x. So given there is an auto update path, that's the easiest way to fix.

  • 🇮🇳India namisha jadhav

    I am still facing this issue in 2.x
    > [notice] Update started: site_settings_update_10006
    > [error] The field fieldset has already been deleted and it is in the process of being purged.

Production build 0.71.5 2024