Plugin not found exception when upgrading to 2x

Created on 23 January 2024, 11 months ago
Updated 19 April 2024, 8 months ago

Problem/Motivation

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\site_settings\SiteSettingsLoaderPluginManager are: full, flattened in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /app/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Steps to reproduce

Upgrade an existing site from 8.1 to 2x

Proposed resolution

  1. Ensure there is an update hook so existing sites are kept on the 'flattened' loader
  2. Ensure that the _install() hook defaults to the 'full' loader for new sites

Remaining tasks

Provide merge request

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom scott_euser

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

Merge Requests

Comments & Activities

  • Issue created by @scott_euser
  • Status changed to Closed: cannot reproduce 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    This actually seems to be working fine. site_settings_update_10004() update hook sets this.

  • Status changed to Needs work 11 months ago
  • πŸ‡¨πŸ‡³China lawxen

    But this prevent drush updb to execute.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Could be because you got it into a broken state already prior to the updb. Maybe try adding the plugin id to config and config import to manually work around it

  • πŸ‡¨πŸ‡³China lawxen

    @scott_euser Thanks for the advice, we has downgrade to 1.x with no error ☺️

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Would be better if we can get to the bottom of this though. Can you provide steps to reproduce from a clean install with 1.x then upgrading? When I try the updb hook seems to work fine.

  • πŸ‡¦πŸ‡ΉAustria roromedia Linz

    I ran also into the same issue that drush updb did not run the update-hook as mentioned in this comment πŸ› Plugin not found exception when upgrading to 2x Needs work . As a quick remedy to fix a broken site you can re-run the update-hook via drush:
    drush php-eval "\Drupal::moduleHandler()->loadInclude('site_settings', 'install'); site_settings_update_10004();"
    Afterwards fllush the cache with drush cr and the site should be up and running again.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Thanks for the tip: are you able to reproduce it eg from a backup? If so perhaps could check whether it needs to be change to a post update hook instead to account for particular scenarios?

  • πŸ‡¦πŸ‡ΉAustria roromedia Linz

    Unfortunately I can't. We run Gitlab-pipelines where the system is always doing a drush updb on every run and after installing version 2.0 it did also run updb but it missed this update_hook it seems which left the site broken. Why I it did not run the update-hook I can't really tell. The upgrade was done with composer on Drupal 10.2.2 - maybe that helps to narrow it down?

  • Status changed to Needs review 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Best I can think of is the updated Merge Request here to just re-run the update hook as a post update hook. Hopefully someone can give this a spin!

  • Pipeline finished with Skipped
    10 months ago
    #93571
  • Status changed to Fixed 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Okay this doesn't hurt at least, so will merge and can always re-open or add a follow-up.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡§πŸ‡ͺBelgium baikho Antwerp, BE

    This still doesn't work for me.

    When I make changes and switch from 8.x-2.0 to 2.0.0-alpha2, I get:

    drush status
    Error: Class "Drupal\site_settings\SiteSettingsLoader" not found in Drupal\Component\DependencyInjection\Container->createService() (line 259 of /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php).
     [warning] Drush command terminated abnormally.
    

    So I run cache clear to clear that error, but then subsequently I cannot run any drush command, incl.:

    drush cr
    
    In DiscoveryTrait.php line 53:
                                                                                                                                    
      The "" plugin does not exist. Valid plugin IDs for Drupal\site_settings\SiteSettingsLoaderPluginManager are: flattened, full  
    

    Or the update hook as per #8:

    drush php-eval "\Drupal::moduleHandler()->loadInclude('site_settings', 'install'); site_settings_update_10004();"
    
    In DiscoveryTrait.php line 53:
                                                                                                                                    
      The "" plugin does not exist. Valid plugin IDs for Drupal\site_settings\SiteSettingsLoaderPluginManager are: flattened, full  
    

    Or configuration set:

    drush cset site_settings.config loader_plugin 'flattened'
    
    In DiscoveryTrait.php line 53:
                                                                                                                                    
      The "" plugin does not exist. Valid plugin IDs for Drupal\site_settings\SiteSettingsLoaderPluginManager are: flattened, full  
    

    It only works when I execute the above cmd ahead of checking out the 2.x codebase.

    drush cset site_settings.config loader_plugin 'flattened'
    
     loader_plugin key does not exist in site_settings.config config. Do you want to create a new config key? (yes/no) [yes]:
     > yes
    
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Can you try to 2.x-dev instead of the alpha release, few more commits haven't yet released in there.

Production build 0.71.5 2024