After enabling ckeditor 5 - go to select text formats and editors - gives error

Created on 7 March 2022, about 3 years ago
Updated 22 January 2023, about 2 years ago

Problem/Motivation

from admin/config when you press link "Text formats and editors" (admin/config/content/formats) gives - The website encountered an unexpected error. Please try again later.

error:
Drupal\Core\Entity\EntityMalformedException: The "filter_format" 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).

I still have old ckeditor installed and in use.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ’ฌ Support request
Status

Closed: outdated

Version

9.3

Component
CKEditor 5ย  โ†’

Last updated 4 days ago

Created by

๐Ÿ‡ซ๐Ÿ‡ฎFinland Klaus Juhantalo

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.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland Klaus Juhantalo

    3. Can i send this module with email to you as I cant put it public?
    4. php errors - below all
    5. is there tool to check database, that all needed fields exists? Referring this error, https://www.drupal.org/project/drupal/issues/3322772 โ†’

    6. admin/config/content/formats

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

    Drupal\Core\Entity\EntityMalformedException: The "filter_format" 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: 136)
    Drupal\Core\Entity\EntityListBuilder->getDefaultOperations() (Line: 33)
    Drupal\Core\Config\Entity\ConfigEntityListBuilder->getDefaultOperations() (Line: 135)
    Drupal\filter\FilterFormatListBuilder->getDefaultOperations() (Line: 112)
    Drupal\Core\Entity\EntityListBuilder->getOperations() (Line: 193)
    Drupal\Core\Entity\EntityListBuilder->buildOperations() (Line: 175)
    Drupal\Core\Entity\EntityListBuilder->buildRow() (Line: 86)
    Drupal\Core\Config\Entity\DraggableListBuilder->buildRow() (Line: 128)
    Drupal\filter\FilterFormatListBuilder->buildRow() (Line: 126)
    Drupal\Core\Config\Entity\DraggableListBuilder->buildForm() (Line: 153)
    Drupal\filter\FilterFormatListBuilder->buildForm()
    call_user_func_array() (Line: 534)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 281)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 222)
    Drupal\Core\Form\FormBuilder->getForm() (Line: 94)
    Drupal\Core\Config\Entity\DraggableListBuilder->render() (Line: 23)
    Drupal\Core\Entity\Controller\EntityListController->listing()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 168)
    Drupal\purge_queuer_url\StackMiddleware\UrlRegistrar->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 713)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    -----------------------------------------
    4. php errors - below
    Type php
    /admin/config/content/formats

    Drupal\Core\Entity\EntityMalformedException: The "filter_format" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/Entity/EntityBase.php).

    ------

    hacked module gives php error also:
    e Deprecated function: Required parameter $file follows optional parameter $storage in include() (line 578 of /var/www/vhosts/sitename/httpdocs/vendor/composer/ClassLoader.php)
    #0 /var/www/vhosts/sitename/httpdocs/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
    #1 /var/www/vhosts/sitename/httpdocs/vendor/composer/ClassLoader.php(578): _drupal_error_handler()
    #2 /var/www/vhosts/sitename/httpdocs/vendor/composer/ClassLoader.php(578): include()
    #3 /var/www/vhosts/sitename/httpdocs/vendor/composer/ClassLoader.php(432): Composer\Autoload\ClassLoader::Composer\Autoload\{closure}()
    #4 /var/www/vhosts/sitename/httpdocs/web/modules/hacked/src/ParamConverter/HackedProjectConverter.php(18): Composer\Autoload\ClassLoader->loadClass()
    #5 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/ParamConverter/ParamConverterManager.php(100): Drupal\hacked\ParamConverter\HackedProjectConverter->convert()
    #6 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php(45): Drupal\Core\ParamConverter\ParamConverterManager->convert()
    #7 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/Routing/Router.php(256): Drupal\Core\Routing\Enhancer\ParamConversionEnhancer->enhance()
    #8 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/Routing/Router.php(130): Drupal\Core\Routing\Router->applyRouteEnhancers()
    #9 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(93): Drupal\Core\Routing\Router->matchRequest()
    #10 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(151): Drupal\Core\Routing\AccessAwareRouter->matchRequest()
    #11 /var/www/vhosts/sitename/httpdocs/web/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php(138): Drupal\Core\Routing\AccessAwareRouter->match()
    #12 /var/www/vhosts/sitename/httpdocs/web/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUserAdmin.php(104): Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin->isAdminPath()
    #13 /var/www/vhosts/sitename/httpdocs/web/core/modules/language/src/LanguageNegotiator.php(188): Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin->getLangcode()
    #14 /var/www/vhosts/sitename/httpdocs/web/core/modules/language/src/LanguageNegotiator.php(133): Drupal\language\LanguageNegotiator->negotiateLanguage()
    #15 /var/www/vhosts/sitename/httpdocs/web/core/modules/language/src/ConfigurableLanguageManager.php(218): Drupal\language\LanguageNegotiator->initializeType()
    #16 /var/www/vhosts/sitename/httpdocs/web/core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php(92): Drupal\language\ConfigurableLanguageManager->getCurrentLanguage()
    #17 /var/www/vhosts/sitename/httpdocs/web/core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php(74): Drupal\language\EventSubscriber\LanguageRequestSubscriber->setLanguageOverrides()
    #18 [internal function]: Drupal\language\EventSubscriber\LanguageRequestSubscriber->onKernelRequestLanguage()
    #19 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
    #20 /var/www/vhosts/sitename/httpdocs/vendor/symfony/http-kernel/HttpKernel.php(145): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
    #21 /var/www/vhosts/sitename/httpdocs/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #22 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #23 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #24 /var/www/vhosts/sitename/httpdocs/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #25 /var/www/vhosts/sitename/httpdocs/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #26 /var/www/vhosts/sitename/httpdocs/web/modules/purge_queuer_url/src/StackMiddleware/UrlRegistrar.php(168): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #27 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\purge_queuer_url\StackMiddleware\UrlRegistrar->handle()
    #28 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #29 /var/www/vhosts/sitename/httpdocs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #30 /var/www/vhosts/sitename/httpdocs/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle()
    #31 /var/www/vhosts/sitename/httpdocs/web/index.php(19): Drupal\Core\DrupalKernel->handle()
    #32 {main}

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    "hacked module" โ†’ did you hack a module?

    That would explain why

      public function toUrl($rel = 'canonical', array $options = []) {
        if ($this->id() === NULL) {
          throw new EntityMalformedException(sprintf('The "%s" entity cannot have a URI as it does not have an ID', $this->getEntityTypeId()));
        }
    โ€ฆ
    

    is occurring for you.

    It sounds like you manually modified Drupal core files?

  • ๐Ÿ‡จ๐Ÿ‡ดColombia camilo.escobar

    I encountered the same error when accessing the "Text formats and editors" admin page (/admin/config/content/formats).

    The issue stemmed from the configuration file for the text filter defined by the Aggregator module (filter.format.aggregator_html.yml). The file contained insufficient content, omitting key properties like uuid and format. This was its only content:

    dependencies:
      enforced:
        module:
          - aggregator
    

    At some point, importing this configuration created a config entity without an ID, causing the error that broke the admin page:

    Drupal\Core\Entity\EntityMalformedException: The "filter_format" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of /code/web/core/lib/Drupal/Core/Entity/EntityBase.php).

    Iโ€™ll need to review the Git history to determine why the file was truncated. While I canโ€™t yet confirm the Aggregator module as the root cause, further analysis is required to identify the exact flow that led to this issue.

    In the meantime, I resolved the problem as follows:

    1. Force-deleted the faulty configuration entity using a hook_update_N:

    /**
     * Implements hook_update_N().
     *
     * Remove aggregator_html text format configuration, so we can re-add it via
     * config import.
     */
    function mymodule_update_10001(&$sandbox) {
      \Drupal::configFactory()->getEditable('filter.format.aggregator_html')->delete();
    }
    

    2. Manually fixed the filter.format.aggregator_html.yml file with the correct content, based on the moduleโ€™s default configuration: https://git.drupalcode.org/project/aggregator/-/blob/2.2.2/config/instal...

    langcode: en
    status: true
    dependencies:
      enforced:
        module:
          - aggregator
    name: 'Aggregator HTML'
    format: aggregator_html
    weight: 0
    roles: {  }
    filters:
      filter_html:
        id: filter_html
        provider: filter
        status: true
        weight: 0
        settings:
          allowed_html: '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'
          filter_html_help: true
          filter_html_nofollow: false
    

    3. Re-imported the configuration to recreate the text format entity: drush cim

    4. Exported the configuration to ensure everything is in sync: drush cex

    This solution may help others encountering the same issue.

Production build 0.71.5 2024