Broken/Missing block appears

Created on 15 June 2016, about 8 years ago
Updated 14 December 2023, 6 months ago

Hi folks

I have a drupal 8 project with a broken block definition/configuration or something similar. So i can't use the entity reference field with blocks, because this error appears if drupal wants to show me all available blocks in a field widget or something (e.g. node edit form) for example:

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginException: The block '' did not specify a plugin. in Drupal\block\BlockPluginCollection->initializePlugin() (line 53 of core/modules/block/src/BlockPluginCollection.php).

Drupal\Component\Plugin\LazyPluginCollection->get(NULL) (Line: 45)
Drupal\block\BlockPluginCollection->get(NULL) (Line: 135)
Drupal\block\Entity\Block->getPlugin() (Line: 198)
Drupal\block\Entity\Block->label() (Line: 297)
Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection->getReferenceableEntities(NULL, 'CONTAINS', 0) (Line: 25)
Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection->getReferenceableEntities() (Line: 538)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->getSettableOptions(Object) (Line: 116)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase->getOptions(Object) (Line: 34)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsSelectWidget->formElement(Object, 0, Array, Array, Object) (Line: 324)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 85)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 298)
Drupal\Core\Field\FieldItemList->defaultValuesForm(Array, Object) (Line: 97)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 115)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 512)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('field_config_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I don't know why i have a Broken/Missing block, and i don't know which block that was before that happens, because i don't miss any block.

At first i thought the error disapperars with resaving the admin page (block layout) ( https://www.drupal.org/node/2744823 β†’ ). But i was wrong. The error is still there.

If i use this code:

$block_manager = \Drupal::service('plugin.manager.block');
$definitions = $block_manager->getDefinitions();
dpm($definitions);

The definitions has a broken array:

If i comment out the exception (line 53 of core/modules/block/src/BlockPluginCollection.php), the node edit form loads and i can see this:

Sorry for not more information about reproducing this error. But i don't know why this error appears.

With a new drupal installation, everthink works fine. But somehow i get this error now and i can't reinstall drupal with the current procject.

Question: What can i do to repair this?

And maybe this is a bug which caused all.

πŸ› Bug report
Status

Closed: outdated

Version

9.5

Component
BlockΒ  β†’

Last updated 10 days ago

Created by

πŸ‡¨πŸ‡­Switzerland handkerchief

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.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Going to close this as outdated due to the lack of reproducible steps and the length of time since this was posted.

    Please reopen with clear steps to reproduce if required. Thanks!

Production build 0.69.0 2024