Call to a member function getFieldStorageDefinition() on null

Created on 20 July 2022, almost 2 years ago
Updated 14 May 2024, about 1 month ago

Problem/Motivation

The website encountered an unexpected error while taking structure->BLock Layout->Block Type
\n
 Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition()

Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition() (Line: 536)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::onDependencyRemoval() (Line: 263)
Drupal\Core\Field\FieldConfigBase->onDependencyRemoval() (Line: 497)
Drupal\Core\Config\ConfigManager->callOnDependencyRemoval() (Line: 360)
Drupal\Core\Config\ConfigManager->getConfigEntitiesToChangeOnDependencyRemoval() (Line: 88)
Drupal\user\Form\EntityPermissionsForm->permissionsByProvider() (Line: 173)
Drupal\user\Form\EntityPermissionsForm->access()
call_user_func_array() (Line: 75)
Drupal\Core\Access\CustomAccessCheck->access()
call_user_func_array() (Line: 160)

Drupal core Version:9.4.2

Steps to reproduce

Steps to reproduce: admin/structure/block/block-content/types
Manage->Structure->Block Layout->Block type

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Configuration entity 

Last updated about 14 hours ago

Created by

🇮🇳India ashna.ms

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @logicbus I encountered the exact same problem you are describing. Except that I don't know if the site used to have Workbench Moderation, but it's possible.

    I deleted the moderation_state field using:
    drush config-delete "core.base_field_override.block_content.custom_block.moderation_state"

    That solved the problem for me.

    Note that your block type might be called something else. You can see all the config names in the "config" database table.

  • 🇺🇸United States alfattal Minnesota

    I'm having a similar issue importing the config to the database after upgrading to Drupal 10.2. The command $ drush cimterminates with the following error message when it reaches any config related to moderation.state.

    Error: Call to a member function getSettings() on null in Drupal\Core\Field\FieldConfigBase->getSettings() (line 372 of /docroot/core/lib/Drupal/Core/Field/FieldConfigBase.php).

    When deleting these config files, the import completes successfully.

    System Info:

    • Drupal 10.2.
    • PHP 8.1 & MySQL 8
    • Drush 12.4.3.0
  • 🇸🇦Saudi Arabia abdulaziz zaid Riyadh

    I have the same problem and I delete all files related to the 'Moderation state' After I finish importing the config sync I back the files to the config and I run config import again it is working fine.

  • Status changed to Active 4 months ago
  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    Same error here after updating from drupal 10.1.8 to 10.2.3 and making a drush si.
    After deleting al configs related to moderation state, the error is gone.
    We will try to provide more info.

  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    This is an example of file that we removed:
    config/default/core.base_field_override.node.article.moderation_state.yml

    -uuid: 7eec08fd-0047-4a46-82c7-332e22dad1f6
    -langcode: en
    -status: true
    -dependencies:
    -  config:
    -    - node.type.article
    -id: node.article.moderation_state
    -field_name: moderation_state
    -entity_type: node
    -bundle: article
    -label: 'Moderation state'
    -description: 'The moderation state of this piece of content.'
    -required: false
    -translatable: true
    -default_value: {  }
    -default_value_callback: ''
    -settings: {  }
    -field_type: string
    
  • 🇪🇸Spain rodrigoaguilera Barcelona

    Deleting the

    core.base_field_override.*.*.moderation_state.yml
    

    worked for me. They were created by saving the content translation form and just like in comment #12 they did not change anything from the defaults so there was no need for an override.

    After exporting the config, trying to install the site from that config leads to the error from the IS.

Production build 0.69.0 2024