Cannot create custom blocks after module installation

Created on 18 January 2022, almost 3 years ago
Updated 22 April 2024, 8 months ago

Problem/Motivation

I cannot create new blocks after installing this module. Happened on 8.9.20 as well as on 9.2.10 now.
I get

"The machine-readable name must contain only lowercase letters, numbers, and underscores"

no matter what block name I choose. The "Machine name" info including the "Edit" link as shown on the module's project homepage is not visible, either.

This is the log entry:

Warning: preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 1 in Drupal\Core\Render\Element\MachineName::validateMachineName() (Line 247 in /var/www/drupal/web/core/lib/Drupal/Core/Render/Element/MachineName.php)

#0 /var/www/drupal/web/core/includes/bootstrap.inc(312): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/drupal/web/core/lib/Drupal/Core/Render/Element/MachineName.php(247): preg_match()
#3 [internal function]: Drupal\Core\Render\Element\MachineName::validateMachineName()
#4 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(282): call_user_func_array()
#5 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm()
#6 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm()
#7 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm()
#8 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm()
#9 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm()
#10 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormValidator->validateForm()
#11 /var/www/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm()
#12 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm()
#13 /var/www/drupal/web/core/modules/block_content/src/Controller/BlockContentController.php(115): Drupal\Core\Entity\EntityFormBuilder->getForm()
#14 /var/www/drupal/web/core/modules/block_content/src/Controller/BlockContentController.php(80): Drupal\block_content\Controller\BlockContentController->addForm()
#15 [internal function]: Drupal\block_content\Controller\BlockContentController->add()
#16 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#17 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(578): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#24 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#26 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#27 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#28 /var/www/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#29 /var/www/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(717): Stack\StackedHttpKernel->handle()
#30 /var/www/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#31 {main}

Steps to reproduce

Install block_content_machine_name 8.x-2.0 via composer.
Try to add a custom block.

These are the other installed/enabled modules:

  Core                                 Automated Cron (automated_cron)                                           Enabled    9.2.10
  Core                                 Block (block)                                                             Enabled    9.2.10
  Core                                 Custom Block (block_content)                                              Enabled    9.2.10
  Core                                 Breakpoint (breakpoint)                                                   Enabled    9.2.10
  Core                                 CKEditor (ckeditor)                                                       Enabled    9.2.10
  Core                                 Color (color)                                                             Enabled    9.2.10
  Core                                 Comment (comment)                                                         Enabled    9.2.10
  Core                                 Configuration Manager (config)                                            Enabled    9.2.10
  Core                                 Contact (contact)                                                         Enabled    9.2.10
  Core                                 Contextual Links (contextual)                                             Enabled    9.2.10
  Field types                          Datetime (datetime)                                                       Enabled    9.2.10
  Core                                 Database Logging (dblog)                                                  Enabled    9.2.10
  Core                                 Internal Dynamic Page Cache (dynamic_page_cache)                          Enabled    9.2.10
  Core                                 Text Editor (editor)                                                      Enabled    9.2.10
  Core                                 Field (field)                                                             Enabled    9.2.10
  Core                                 Field UI (field_ui)                                                       Enabled    9.2.10
  Field types                          File (file)                                                               Enabled    9.2.10
  Core                                 Filter (filter)                                                           Enabled    9.2.10
  Web services                         HAL (hal)                                                                 Enabled    9.2.10
  Core                                 Help (help)                                                               Enabled    9.2.10
  Core                                 History (history)                                                         Enabled    9.2.10
  Field types                          Image (image)                                                             Enabled    9.2.10
  Multilingual                         Language (language)                                                       Enabled    9.2.10
  Field types                          Link (link)                                                               Enabled    9.2.10
  Multilingual                         Interface Translation (locale)                                            Enabled    9.2.10
  Core                                 Custom Menu Links (menu_link_content)                                     Enabled    9.2.10
  Core                                 Menu UI (menu_ui)                                                         Enabled    9.2.10
  Migration                            Migrate (migrate)                                                         Enabled    9.2.10
  Core                                 Node (node)                                                               Enabled    9.2.10
  Field types                          Options (options)                                                         Enabled    9.2.10
  Core                                 Internal Page Cache (page_cache)                                          Enabled    9.2.10
  Core                                 Path (path)                                                               Enabled    9.2.10
  Core                                 Path alias (path_alias)                                                   Enabled    9.2.10
  Core                                 Quick Edit (quickedit)                                                    Enabled    9.2.10
  Core                                 RDF (rdf)                                                                 Enabled    9.2.10
  Core                                 Search (search)                                                           Enabled    9.2.10
  Web services                         Serialization (serialization)                                             Enabled    9.2.10
  Core                                 Shortcut (shortcut)                                                       Enabled    9.2.10
  Core                                 System (system)                                                           Enabled    9.2.10
  Core                                 Taxonomy (taxonomy)                                                       Enabled    9.2.10
  Field types                          Text (text)                                                               Enabled    9.2.10
  Core                                 Toolbar (toolbar)                                                         Enabled    9.2.10
  Core                                 Update Manager (update)                                                   Enabled    9.2.10
  Core                                 User (user)                                                               Enabled    9.2.10
  Core                                 Views (views)                                                             Enabled    9.2.10
  Core                                 Views UI (views_ui)                                                       Enabled    9.2.10
  Administration                       Admin Toolbar (admin_toolbar)                                             Enabled    3.0.3
  Field types                          AudioField (audiofield)                                                   Enabled    8.x-1.11
  Other                                Block Content Machine Name (block_content_machine_name)                   Enabled    8.x-2.0
  Other                                Configuration Update Base (config_update)                                 Enabled    8.x-1.7
  Chaos tool suite                     Chaos Tools (ctools)                                                      Enabled    8.x-3.7
  Other                                Editor File Upload (editor_file)                                          Enabled    8.x-1.6
  Search                               Facets (facets)                                                           Enabled    2.0.0
  Development                          Features (features)                                                       Enabled    8.x-3.12
  Development                          Features UI (features_ui)                                                 Enabled    8.x-3.12
  Other                                Fixed Block Content (fixed_block_content)                                 Enabled    8.x-1.1
  Media                                Imce File Manager (imce)                                                  Enabled    8.x-2.4
  Other                                Libraries (libraries)                                                     Enabled    8.x-3.0-beta2
  Field types                          Machine Name Widget (machine_name_widget)                                 Enabled    8.x-2.0-alpha2
  Statistics                           Matomo Analytics (matomo)                                                 Enabled    8.x-1.14
  Other                                Menu Block (menu_block)                                                   Enabled    8.x-1.7
  Other                                Menu Breadcrumb (menu_breadcrumb)                                         Enabled    8.x-1.16
  Other                                Menu Trail By Path (menu_trail_by_path)                                   Enabled    8.x-1.3
  SEO                                  Metatag (metatag)                                                         Enabled    8.x-1.18
  Migration                            Migrate Plus (migrate_plus)                                               Enabled    8.x-5.2
  Migration                            Migrate Process URL (migrate_process_url)                                 Enabled
  Migration                            Migrate Tools (migrate_tools)                                             Enabled
  Other                                Pathauto (pathauto)                                                       Enabled    8.x-1.8
  Search                               Database Search (search_api_db)                                           Enabled    8.x-1.21
  Search                               Search API (search_api)                                                   Enabled    8.x-1.21
  SEO                                  Simple XML Sitemap (simple_sitemap)                                       Enabled    8.x-3.11
  Fields                               Smart Trim (smart_trim)                                                   Enabled    8.x-1.3
  Statistics                           Tether Stats (tether_stats)                                               Enabled    8.x-1.04
  Other                                Toc.js per node (toc_js_per_node)                                         Enabled    8.x-1.8
  Other                                Toc js (toc_js)                                                           Enabled    8.x-1.8
  Other                                Token (token)                                                             Enabled    8.x-1.10
  users                                User Redirect (user_redirect)                                             Enabled    1.0.1
  Video Embed Field                    Video Embed WYSIWYG (video_embed_wysiwyg)                                 Enabled    8.x-2.4
  Video Embed Field                    Video Embed Field (video_embed_field)                                     Enabled    8.x-2.4
  Views                                Views block area (views_block_area)                                       Enabled    8.x-1.0-beta3
  Core                                 Bartik (bartik)                                                           Enabled    9.2.10
  Core                                 Classy (classy)                                                           Enabled    9.2.10
  Core                                 Seven (seven)                                                             Enabled    9.2.10
  Core                                 Stable (stable)                                                           Enabled    9.2.10
  Core                                 Zircon (zircon)                                                           Enabled    8.1.3

Uninstallation/reinstallation does not fix the issue.

What does work is downgrading to block_content_machine_name 1.5.0 and machine_name_widget 1.0.0 on 8.9.20. (The machine_name box and and edit link are there and work as expected).
Starting with block_content_machine_name 1.6.0 (and machine_name_widget 1.0.0) it does not work anymore. (The error is

Machine name is required

with v1.6.0, and the text box and edit link are gone)

However, 8.9.x is out of support, so this is not a solution.

Thanks!

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇦🇹Austria tgoeg

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