Drupal\Core\Entity\EntityMalformedException regression caused by 3477436

Created on 14 October 2025, 17 days ago

Problem/Motivation

The post_update implemented in πŸ› Uninstalling Module is not removing image styles image.style.cke_media_resize_large Active assumes the image style configs exist. In cases where those image styles have been deleted (we don't use them on our sites), the update re-creates the config items, but with the dependency only, e.g.

dependencies:
  enforced:
    module:
      - ckeditor_media_resize

None of the other image style config is present. If you then visit /admin/config/media/image-styles, you get the fatal error below, because the resurrected configs items are indeed malformed.

Drupal\Core\Entity\EntityMalformedException: The "image_style" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of core/lib/Drupal/Core/Entity/EntityBase.php).
Drupal\Core\Config\Entity\ConfigEntityBase->toUrl() (Line: 39)
Drupal\image\ImageStyleListBuilder->getDefaultOperations() (Line: 132)
Drupal\Core\Entity\EntityListBuilder->getOperations() (Line: 242)
Drupal\Core\Entity\EntityListBuilder->buildOperations() (Line: 224)
Drupal\Core\Entity\EntityListBuilder->buildRow() (Line: 29)
Drupal\image\ImageStyleListBuilder->buildRow() (Line: 272)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 51)
Drupal\image\ImageStyleListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

- Prior to updating to 1.0.1, delete the image styles provided with the module ('CKE Media Resize Large', et al.)
- Upgrade to 1.0.1, and run updates
- Visit the Image Styles page.

Proposed resolution

Modify the post_update hook to do nothing if the configs do not exisit.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

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

Merge Requests

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