The "script" entity cannot have a URI as it does not have an ID

Created on 2 April 2024, 3 months ago

Problem/Motivation

When trying to access scripts through CMS receive this error message:

The website encountered an unexpected error. Try again later.

Drupal\Core\Entity\EntityMalformedException: The "script" 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: 148)
Drupal\Core\Entity\EntityListBuilder->getDefaultOperations() (Line: 40)
Drupal\Core\Config\Entity\ConfigEntityListBuilder->getDefaultOperations() (Line: 124)
Drupal\Core\Entity\EntityListBuilder->getOperations() (Line: 212)
Drupal\Core\Entity\EntityListBuilder->buildOperations() (Line: 194)
Drupal\Core\Entity\EntityListBuilder->buildRow() (Line: 28)
Drupal\script_manager\ScriptListBuilder->buildRow() (Line: 242)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
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: 44)
Drupal\redirect_after_login\RedirectMiddleware->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 53)
Asm89\Stack\Cors->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: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

On a site that is using Drupal version 10.2.4 with Script Manager 2.0.0-rc2, select "Javascript Snippets" from "Structure" dropdown menu.

Proposed resolution

I'm not sure where, but provide an if statement for the possibility of a null value for ID when calling buildRow() function

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

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

Comments & Activities

Production build 0.69.0 2024