Block save error - reproducible

Created on 26 July 2023, 11 months ago
Updated 1 August 2023, 11 months ago

OK - this is reproducible using block_class, but there may be other ramifications here.

Create a block, assign it to the appropriate site/theme in block layout, adding a class. Save.

Configure block. Add another class. Save. Note that the class isn't saved.

Remove the block. Try to add it back, including the desired classes. (The class field will be blank.) Save.

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

Log: The machine-readable name is already in use. It must be unique.

Go to block layout where you will, indeed, see the block. Configure the block in question. Note that updated settings are, indeed, changed.

So even though you can get around this, I'd still suggest that it's major. Any suggestions greatly appreciated... thanks!

P.S. - Order also doesn't save, even if using weight. Weight for all blocks in region reverts to 0.

UPDATE: Not sure where the problem is, so to be fair, I also posted a link to this thread on the Block Class issue queue: https://www.drupal.org/project/block_class/issues/3377455 💬 Block save errors with Domain Access Active

🐛 Bug report
Status

Active

Version

2.0

Component

Miscellaneous

Created by

🇺🇸United States bcobin

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

Comments & Activities

  • Issue created by @bcobin
  • 🇺🇸United States bcobin
  • 🇺🇸United States bcobin
  • 🇮🇳India ravi kant Jaipur

    @bcobin

    I am using block class module regularly and same as you explained but never get this type error.

    Can you share the detailed error message? Use $config['system.logging']['error_level'] = 'verbose'; in setting.php or setting.local.php for it.

    I think there is some other broken issue which will debug with detailed error message. Also you may check "Recent log messages" for detailed error message.

  • 🇺🇸United States bcobin

    Thanks, Ravi! See below - there are three errors in the log for each failure.

    Something occurs to me: I'm using a Bootstrap 5 subtheme for all affiliates; theme structure is:

    themes > custom > subtheme > config > optional > block.block.[subtheme_name]_[various].yml

    For each affiliate theme, I'm copying an existing theme and changing the name and content of the .yml file accordingly.

    Here's what I'm wondering:

    Each .yml file declares a specific ID:

    langcode: en
    status: true
    dependencies:
      config:
        - system.menu.account
      module:
        - system
      theme:
        - [affiliate_theme]
    id: [affiliate_theme]_account_menu
    theme: [affiliate_theme]
    region: nav_additional
    weight: -7
    provider: null
    plugin: 'system_menu_block:account'
    settings:
      id: 'system_menu_block:account'
      label: 'User account menu'
      provider: system
      label_display: '0'
      level: 1
      depth: 0
      expand_all_items: false
    visibility: {  }

    Note the ID under settings. (In this case, id: 'system_menu_block:account')

    I haven't changed these IDs. So although the names are different for each affiliate, could the errors be on account of the same id (in this case, 'system_menu_block:account') being used across several sites?

    I don't see how this could/should affect custom blocks, though. In any event, below are the error messages. Thanks for reaching out - greatly appreciated!

    Error #1:

    Warning: Undefined array key "core.extension:global_overrides:[affiliate]_comen" in Drupal\domain_config_ui\Config\ConfigFactory->doLoadMultiple() (line 92 of /home/[site]/web/modules/contrib/domain/domain_config_ui/src/Config/ConfigFactory.php)
    #0 /home/[site]/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(2, 'Undefined array...', '/home/[site]/...', 92)
    #1 /home/[site]/web/modules/contrib/domain/domain_config_ui/src/Config/ConfigFactory.php(92): _drupal_error_handler(2, 'Undefined array...', '/home/icrmedia/...', 92)
    #2 /home/[site]/web/modules/contrib/domain/domain_config_ui/src/Config/ConfigFactory.php(112): Drupal\domain_config_ui\Config\ConfigFactory->doLoadMultiple(Array, true)
    #3 /home/[site]/web/core/lib/Drupal/Core/Config/ConfigFactory.php(89): Drupal\domain_config_ui\Config\ConfigFactory->doGet('core.extension')
    #4 /home/[site]/web/core/lib/Drupal/Core/Extension/ThemeHandler.php(70): Drupal\Core\Config\ConfigFactory->get('core.extension')
    #5 /home/[site]/web/core/modules/block/block.module(169): Drupal\Core\Extension\ThemeHandler->listInfo()
    #6 [internal function]: block_rebuild()
    #7 /home/[site]/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array(Object(Closure), Array)
    #8 /home/[site]/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'block')
    #9 /home/[site]/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith('rebuild', Object(Closure))
    #10 /home/[site]/web/core/includes/common.inc(510): Drupal\Core\Extension\ModuleHandler->invokeAll('rebuild')
    #11 /home/[site]/web/modules/contrib/admin_toolbar/admin_toolbar_tools/src/Controller/ToolbarController.php(205): drupal_flush_all_caches()
    #12 [internal function]: Drupal\admin_toolbar_tools\Controller\ToolbarController->flushAll()
    #13 /home/[site]/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #14 /home/[site]/web/core/lib/Drupal/Core/Render/Renderer.php(583): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #15 /home/[site]/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #16 /home/[site]/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #17 /home/[site]/vendor/symfony/http-kernel/HttpKernel.php(166): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #18 /home/[site]/vendor/symfony/http-kernel/HttpKernel.php(74): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #19 /home/[site]/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /home/[site]/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /home/[site]/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /home/[site]/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /home/[site]/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #24 /home/[site]/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #25 /home/[site]/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #26 /home/[site]/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #27 /home/[site]/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #28 {main}

    Error #2:

    Error: Call to a member function setModuleOverride() on null in Drupal\domain_config_ui\Config\ConfigFactory->doLoadMultiple() (line 92 of /home/[site]/web/modules/contrib/domain/domain_config_ui/src/Config/ConfigFactory.php).
    

    Error #3:

    Drupal\Core\Config\ConfigDuplicateUUIDException: Attempt to save a configuration entity 'babylon_subtheme_countdownblock' with UUID 'e911d7c4-df1d-4394-a00b-58209be2997f' when this entity already exists with UUID '43cf125a-1ed8-45ce-9cfc-297d6e0f5b72' in Drupal\Core\Config\Entity\ConfigEntityBase->preSave() (line 314 of /home/[site]/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).
    
  • 🇺🇸United States bcobin

    OK - here's what happens:

    1. Change a block setting and save. (In this case, it was display or override title.)

    2. Note that setting doesn't save.

    3. Remove any title setting from block and save.

    Result: Website reported an unexpected error. (Errors 1 and 2 from above.)

    4. Delete block

    Result: Website reported an unexpected error. (Error 3 from above.)

    5. Re-assign block with desired settings and save.

    Result: Success!

    So there is a workaround, if you can deal with the error messages.

    Any ideas? Thanks!

Production build 0.69.0 2024