Libraries API fails when no install profile is installed

Created on 4 November 2024, 4 months ago

Problem/Motivation

After uninstalling a redundant custom install profile ( which is now possible in Drupal 10.3 and above ), I got this when visiting the Status report page of my site.

Drupal\Core\Extension\Exception\UnknownExtensionException: The profile does not exist. in Drupal\Core\Extension\ExtensionList->getPathname() (line 519 of core/lib/Drupal/Core/Extension/ExtensionList.php).
Drupal\Core\Extension\ExtensionList->getPath() (Line: 170)
libraries_scan_info_files() (Line: 446)
libraries_info() (Line: 550)
libraries_detect() (Line: 27)
image_widget_crop_requirements()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 109)
Drupal\system\SystemManager->listRequirements() (Line: 53)
Drupal\system\Controller\SystemInfoController->status()
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: 68)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 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: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Uninstall a previously used install profile. Visit the Status report page (I'd say there needs to be a module installed that reports the status of a library it utilises via the Libraries APi (for me it was the Image Widget Crop module).

Proposed resolution

Within the lbraries.module file, in the libraries_scan_info_files function, add a conditional check when `\Drupal::installProfile()` equates to `false`.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇦🇺Australia jaydee1818 Melbourne

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024