Used Not Referenced Report Generates Error

Created on 6 February 2023, almost 2 years ago

Problem/Motivation

When I select the Used Not Referenced report via the admin menu, I get a PHP error:

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

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'paragraphs_type' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).
Drupal\Core\Config\Entity\ConfigEntityBase->toUrl('canonical') (Line: 244)
Drupal\Core\Entity\EntityBase->toLink('dojo_block_quote') (Line: 154)
Drupal\auditfiles\Form\AuditFilesUsedNotReferencedForm->Drupal\auditfiles\Form\{closure}(Array, Object)
array_reduce(Array, Object) (Line: 183)
Drupal\auditfiles\Form\AuditFilesUsedNotReferencedForm->buildListForm(Array, Object) (Line: 21)
Drupal\auditfiles\Form\AuditFilesUsedNotReferencedForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm('audit_files_used_not_referenced', Object) (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 713)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Drupal 9.5.2 running on PHP 8.0.26. From the traceback reference to paragraphs something related to that?

Steps to reproduce

Select the Used Not Referenced report via the admin menu

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

4.0

Component

Used not referenced report

Created by

πŸ‡ΊπŸ‡ΈUnited States greggmarshall Aurora/Denver, Colorado

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

Merge Requests

Comments & Activities

  • Issue created by @greggmarshall
  • πŸ‡§πŸ‡ΎBelarus e.bogatyrev

    e.bogatyrev β†’ made their first commit to this issue’s fork.

  • Status changed to Needs review over 1 year ago
  • πŸ‡§πŸ‡ΎBelarus e.bogatyrev

    Hi there,
    Please take a look and review MR https://git.drupalcode.org/project/auditfiles/-/merge_requests/21

    How to repoduce the issue

    1. Create any paragraph type
    2. Add an icon to the field "Paragraph type icon"
    3. Go to the report "/admin/reports/auditfiles/usednotreferenced"
  • Status changed to Needs work over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia dpi Perth, Australia

    Moreover I moved the reducer callback to separate method. IMHO, now it's more readable and maintainable.

    This is a matter of opinion, and not relevant to this issue. The proposed change is rejected. The required LOC's should be very minimal.

    --

    Please use the nullsafe operator instead of assigning to a temporary $has variable. continue to initalise a $source=null within the closure if required.

  • πŸ‡ΊπŸ‡ΈUnited States somebodysysop

    I am getting the exact error on a new Drupal 10 install. Well, it's actually a 9.5.11 site that was upgraded to 10.1.16 and AuditFiles installed after the upgrade.

    But, I'm only getting it with "usednotmanaged".

    Any guidance on how to fix?

    Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'paragraph' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of core/lib/Drupal/Core/Entity/EntityBase.php).
    Drupal\Core\Entity\EntityBase->toLink() (Line: 130)
    Drupal\auditfiles\Form\AuditFilesUsedNotManagedForm->Drupal\auditfiles\Form\{closure}()
    array_reduce() (Line: 140)
    Drupal\auditfiles\Form\AuditFilesUsedNotManagedForm->buildListForm() (Line: 21)
    Drupal\auditfiles\Form\AuditFilesUsedNotManagedForm->buildForm()
    call_user_func_array() (Line: 536)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 283)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
    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: 19)
    Drupal\sbn\Middleware\Redirect->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: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

  • Status changed to Needs review 10 months ago
  • πŸ‡§πŸ‡ΎBelarus e.bogatyrev

    Hi everyone,
    Please review updates https://git.drupalcode.org/project/auditfiles/-/merge_requests/21/diffs
    @dpi all changes are not related to the issue itself have been removed.
    Thanks

  • πŸ‡ΊπŸ‡ΈUnited States nateb Pittsburgh, Pennsylvania, USA

    e.bogatyrev's change at https://git.drupalcode.org/project/auditfiles/-/merge_requests/21/diffs resolves my issues with Used Not Referenced report returning the No link template... error for paragraphs.

    Audit Files 4.2.x-dev | Drupal 10.2.6 | PHP 8.2.16

  • Pipeline finished with Failed
    6 months ago
    Total: 936s
    #199784
  • Pipeline finished with Success
    6 months ago
    Total: 261s
    #202122
  • Pipeline finished with Success
    6 months ago
    Total: 226s
    #202132
  • Status changed to Needs work 13 days ago
  • πŸ‡¦πŸ‡ΊAustralia dpi Perth, Australia

    Bug should be fixed in multiple reports, including Used not managed ( πŸ› Used not managed report generates error Active ).

Production build 0.71.5 2024