Getting the base fields is not supported for entity type Block.

Created on 17 December 2019, about 5 years ago
Updated 10 September 2024, 3 months ago

// Steps to reproduce
This error occurs when a block is saved, or the block layout page is saved.

// Expected behavior
I expected the block to save and the layout page to reload with the updated block.

// What happened
After saving a block (basic block) I got the error below. When I reload the page I see that the block was created and placed into the correct region, but the weight is always set to zero. Adjusting the weight is not possible through the UI because it errors and never updates the weight. I was able to change the block weight manually through config while testing.

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">LogicException</em>: Getting the base fields is not supported for entity type Block. in <em class="placeholder">Drupal\Core\Entity\EntityFieldManager-&gt;buildBaseFieldDefinitions()</em> (line <em class="placeholder">209</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/EntityFieldManager.php</em>). <pre class="backtrace">Drupal\Core\Entity\EntityFieldManager-&gt;getBaseFieldDefinitions(&#039;block&#039;) (Line: 330)
Drupal\Core\Entity\EntityFieldManager-&gt;getFieldDefinitions(&#039;block&#039;, &#039;block&#039;) (Line: 223)
Drupal\entity_usage\EntityUsageTrackBase-&gt;getReferencingFields(Object, Array) (Line: 164)
Drupal\entity_usage\EntityUsageTrackBase-&gt;trackOnEntityUpdate(Object) (Line: 115)
Drupal\entity_usage\EntityUpdateManager-&gt;trackUpdateOnEdition(Object) (Line: 41)
entity_usage_entity_update(Object, &#039;block&#039;)
call_user_func_array(&#039;entity_usage_entity_update&#039;, Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler-&gt;invokeAll(&#039;entity_update&#039;, Array) (Line: 349)
Drupal\Core\Config\Entity\ConfigEntityStorage-&gt;invokeHook(&#039;update&#039;, Object) (Line: 535)
Drupal\Core\Entity\EntityStorageBase-&gt;doPostSave(Object, 1) (Line: 460)
Drupal\Core\Entity\EntityStorageBase-&gt;save(Object) (Line: 263)
Drupal\Core\Config\Entity\ConfigEntityStorage-&gt;save(Object) (Line: 394)
Drupal\Core\Entity\EntityBase-&gt;save() (Line: 613)
Drupal\Core\Config\Entity\ConfigEntityBase-&gt;save() (Line: 381)
Drupal\block\BlockListBuilder-&gt;submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter-&gt;executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter-&gt;doSubmitForm(Array, Object) (Line: 590)
Drupal\Core\Form\FormBuilder-&gt;processForm(&#039;block_admin_display_form&#039;, Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder-&gt;buildForm(Object, Object) (Line: 217)
Drupal\Core\Form\FormBuilder-&gt;getForm(Object) (Line: 116)
Drupal\block\BlockListBuilder-&gt;render(&#039;example&#039;, Object) (Line: 60)
Drupal\block\Controller\BlockListController-&gt;listing(&#039;example&#039;, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

// Some related notes
I had a few broken blocks lingering for a while but I deleted then recreated them and removed all the offending block config. The broken block log messages cleared up but the error persists.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States jnycz

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.

Production build 0.71.5 2024