Hi,

After restarting PHP Worker, my website went down. The log indicates the php error below:

Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginException: "Plugin (metatag_display_extender) instance class "Drupal\metatag_views\Plugin\views\display_extender\MetatagDisplayExtender" does not exist." at /app/mdm_stg/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php line 97

Drupal\Component\Plugin\Exception\PluginNotFoundException : The "metatag_display_extender" plugin does not exist. dans Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (ligne 52 de /app/mdm/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Drupal\Component\Plugin\Exception\PluginNotFoundException : The "metatag_defaults" entity type does not exist. dans Drupal\Core\Entity\EntityTypeManager->getDefinition() (ligne 133 de /app/mdm/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

I have to reupload and rebuild (composer.json ) to get the site Up back.

My question: is this problem is caused by the module drupal/metatag or the server itself? Any Idea?

Drupal version : 8.3.7 
Web Server nginx/1.13.1
PHP Version: 7.0.20
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fidylalaina created an issue. See original summary.

DamienMcKenna’s picture

Component: Code » Views integration

Ugh, that sucks, sorry.

That display enhancer is enabled via metatag_views_install(), could see if you can maybe manually run that code?

MLZR’s picture

Version: 8.x-1.x-dev » 8.x-1.3

Subscribe "The "metatag_display_extender" plugin does not exist. " ..
when upgrade from 1.2 to 8.x-1.3
Drupal 8.4.3

I tryed some things to get it working; clear all cache via phpmyadmin. Delete the map 'metatag' and set back the map from the latest backup (with ver 1.2) bud the error won't die.

So I think I have to set back an total backup..

MLZR’s picture

Ok, I had to restore the whole drupal setup, where version 1.2 was in place. Then I delete the metatag map and copy the version metatag 8.x-1.x dev in pace. And that worked!

joerch’s picture

Subscribe

when upgrade to 8.x-1.4:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "metatag_display_extender" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Anonymous’s picture

This seems to happen to us, but with another module. I'd love some insight on why this happens, but my current theory is:

Ours happens during our CI tests. If we try to rebuild the site cache during tests doing a lot of site searches, it happens with modules that load entities on the front end of our site. Once the error shows up, it doesn't go away on next page load. However if we clear cache again it seems to go away. At some point during the cache clear it seems requests can get through to Drupal and it causes an incomplete plugin discovery phase that ends up getting cached.

joerch’s picture

Now i ran into the same issue again when update to 8.x-1.5:

The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "metatag_display_extender" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

The update via UI went wrong and i had to restore the site. Some files were missing in the metatag directory.
Afterwards i updated the module manually and all was ok.

For me it seems to be a problem with the permissions/owner of the files in the metatag directory. I couldn't find out the exact reason for the issue. Couldn't find any differences to the other modules i could update via UI. Maybe i'll find time later to figure out more.

jigarius’s picture

My site is perfectly healthy and the module installs correctly as well. When I configure metatags for a view and save the configuration with something as basic as a change in the meta title, I get the error:

The configuration property display.page_upcoming.display_options.display_extenders.metatag_display_extender.metatags.robots.index doesn't exist

denomdub’s picture

I am still unable to find a fix for this error. I am start updating to the latest drupal 8 version (8.5.4) and i get the AJAX 500 error (update is unable to complete) and this in the log.

Drupal\\Component\\Plugin\\Exception\\PluginNotFoundException: The "metatag_display_extender" plugin does not exist. in /Users/deniswamala/Sites/SPU/www/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php on line 52

Has anyone gotten this error like this and successfully fixed it?

Kindly Help

Denis

aangel’s picture

This was happening to me after I upgraded to 8.5.4. I ran metatag_views_install() but that wasn't the problem.

Inside AnnotatedClassDiscovery.php, this code:

  protected function getPluginNamespaces() {
    $plugin_namespaces = [];
    if ($this->namespaceSuffix) {
      foreach ($this->rootNamespacesIterator as $namespace => $dirs) {
        // Append the namespace suffix to the base namespace, to obtain the
        // plugin namespace; for example, 'Drupal\Views' may become
        // 'Drupal\Views\Plugin\Block'.
        $namespace .= $this->namespaceSuffix;
        foreach ((array) $dirs as $dir) {
          // Append the directory suffix to the PSR-4 base directory, to obtain
          // the directory where plugins are found. For example,
          // DRUPAL_ROOT . '/core/modules/views/src' may become
          // DRUPAL_ROOT . '/core/modules/views/src/Plugin/Block'.
          $plugin_namespaces[$namespace][] = $dir . $this->directorySuffix;
        }
      }
    }

was not looking for "modules/contrib/metatag/metatag_views/src/Plugin/views/display_extender," the iterator skips over it (though it did look inside the metatag module). Attempting to cheat by placing MetatagDisplayExtender.php (which contains the annotation @ViewsDisplayExtender) in metatag/src/Plugin/views/display_extender did not work.

The rootNamespacesIterator simply was not producing /metatag/metatag_views for the namespace check to occur. Checking with "drush pml" showed that metatag_views was not enabled—but I didn't turn it off.

Re-enabling the module allows Drupal to find the annotated class because it correctly scans the correct module that contains it.

I have no idea what turned off the module. I did not upgrade Metatag (current version was fine per composer). I did, however, allow Pantheon to upgrade the code to 8.5.4.

Until the mystery of The Curious Case of the Auto-Disabling Module is discovered, performing the following at least worked for me:

drush en -y metatag_view 
denomdub’s picture

Thanks for the response @aangel but I am unable to find the module metatag_view

DamienMcKenna’s picture

That would have been a small typo, please try this:
drush en -y metatag_views

denomdub’s picture

Apologies for the delayed response. I had to re-install Composer & Drush and the site (from backup)
Here's the error i get now at the terminal:

error] Configuration objects (metatag.metatag_defaults.403, metatag.metatag_defaults.404, metatag.metatag_defaults.front, metatag.metatag_defaults.global, metatag.metatag_defaults.node, metatag.metatag_defaults.taxonomy_term, metatag.metatag_defaults.user) provided by metatag already exist in active configuration

Makes sense?

I Tried removing it with composer and putting it back, enabled it with drush and still came up with the same error on the terminal.

Looking forward to any assistance,
Kind regards,
Denis

denomdub’s picture

Here's how i got it fixed!

  1. I accessed the config table (Via phpmyadmin), looked for the entries listed above (which basically included all the metatag entries in the table), and deleted them.
  2. Re-enabled metatag & metatag_views (using drush)

Error was gone.

(Hope this helps someone as well). Thanks for everthing.

DamienMcKenna’s picture

FYI I ran into this problem when restructuring the codebase of a site - the Metatag module was moved to a different directory and after I ran "drush cr all" it threw the error.

DamienMcKenna’s picture

Version: 8.x-1.3 » 8.x-1.x-dev
Nigel Cunningham’s picture

Just logging another potential cause of the above error.

I'm seeking to build a profile with a bunch of pre-enabled modules, including Views and Metatag views. The config export views.settings.yml includes

display_extenders:
  - metatag_display_extender

and this causes an error when trying to install the profile (it looks like metatag views is not yet enabled when a view gets restored). Seems like a bit of a circular dependency. My simple fix was to remove the above two lines from view.settings.yml, but I realise that's not a proper fix (Getting this profile install working is just one bug after another so please forgive my laziness on this count!)

Rob230’s picture

#10 has solved this problem for me. I don't know how metatag_views disabled itself, but re-enabling it solved the exception.

mpp’s picture

This error might be caused by a few things:
- a wrong namespace in the plugin
- cached plugins (run cache-clear)

See https://www.drupal.org/project/drupal/issues/1846070 for an improved error message.

jrearick’s picture

Just running in to this when adding metatag_views to our profile. We had metatag and other metatag_* modules installed from before, no problem. To enable metatag_views on initial install we added metatag_views to our core.extension.yml and the display_extender to views.settings.yml and it works just fine.

The issue comes in when I tried writing a hook_update in the profile to enable the module:

/**
 * Install metatag_views module.
 */
function myprofile_update_8801() {
  \Drupal::service('module_installer')->install(['metatag_views']);
}

After running this db update on an existing site with drush updb, it doesn't seem to be installed. I go to the DB and see that metatag_views is not in the list for core.extension.yml and views.settings.yml are not updated. I clear cache drush cr and the entire site blows up that it can't find the metatag_display_extender plugin.

I can fix it by drush pm-uninstall metatag_views then drush enable metatag_views. But that isn't a really good way to move forward with adding a one-time step to our deployment process. I found that enabling the module any other way seems to work just fine. Here's what I tried:

  • Running update.php from the browser works.
  • Installing via drush works drush enable metatag_views.
  • Installing via drush php command line drush php:cli then copy/paste in \Drupal::service('module_installer')->install(['metatag_views']); returns true and works

So, this leads me to believe the drush updb process misses something. I was running Drush 9.7.1. There were no errors in any logs I could find (watchdog, php, apache), except for the resulting error about not finding the metatag_display_extender plugin.

The final solution for us was to add drupal_flush_all_caches(); in our update hook immediately after install.

I hope this comment helps others with the same issue.

Phil Wolstenholme’s picture

I had this issue when trying to add metatag_views to an install profile too.

I fixed this issue by adding a config dependency on metatag_views to views.settings.yml.

dependencies:
  module:
    - metatag_views

It would be good if metatag_views could add this dependency itself, or expose the right information so Drupal Core can be aware of the dependency and include it in the views.settings.yml config file.

Edit: https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-... seems relevant perhaps?

tdnshah’s picture

I am facing the above this issue when using blt and running a blt setup command, while blt tries to reinstall the site from scratch and importing the existing config I get the same error as below:

  The "metatag_display_extender" plugin does not exist. Valid plugin IDs for   
  Drupal\views\Plugin\ViewsPluginManager are: default    

I tried adding the dependencies of metatag_views module in views.settings.ymlfile as, mentioned in #21 but it didnt resolve the issue for me.

DamienMcKenna’s picture

I think adding the dependency on the View definition that uses Metatag would be better than modifying views.settings.yml?

idiaz.roncero’s picture

Same as #22: I can't do a site install from config (used for automated tests, drush si --existing-config -y), this error makes it crash.

metatag_views module is enabled on config.

tdnshah’s picture

@DamienMcKenna tried adding the dependency to the view definition that uses the metatag_views but even this didnt work, secondly I obsered that it fails when scheduler module is getting installed, and hence little confused how and why installation of scheduler module is is looking for

The "metatag_display_extender" plugin does not exist. Valid plugin IDs for   
  Drupal\views\Plugin\ViewsPluginManager are: default 

plugin and causing this to fail.

Looking for directions to debug this further and how this can be resolved ? Any help?

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
457 bytes

I wonder if this was the problem?

DamienMcKenna’s picture

If anyone has reliable instructions for triggering this problem please let me know, I'd love to solve it, thank you.

tdnshah’s picture

Status: Needs review » Needs work

Tested the above patch, its not resolving this Issue.
The steps to reproduce are as below:

Step 1. Create a normal Drupal Install
Step 2. Add and enable metatag module
Step 3. Add and enable metatag_views module
Step 4. Ensure under admin/structure/views/settings/advanced metatag_display_extender
Step 5. Run drush cex and export all the configs.
Step 6. Then try re running drush si and this should cause the error.

DamienMcKenna’s picture

Title: The "metatag_display_extender" plugin does not exist. » The "metatag_display_extender" plugin does not exist
Status: Needs work » Needs review
zakariabdc’s picture

None of the above solutions worked for me.
I tried: $ composer require drupal/metatag_views and it worked.

DamienMcKenna’s picture

Status: Needs review » Needs work

"metatag_views" isn't a separate package available on Packagist, so "composer require drupal/metatag_views" shouldn't have changed your composer files. It does suggest part of the problem might be the class autoloading, and possibly one priority over another.

I wonder if the priority for metatag_views was higher than the views priority, would that fix the problem?

tdnshah’s picture

@zakariabdc I tired adding the composer dependency to the project as mentioned by you, and that does not fix the issue on drush si .

yeah I agree with @DamienMcKenna on adding the module as a composer dependency, it do not make any difference.

@DamienMcKenna I tried changing the priority of the metatag_views in mycore.extension file, but no even that do not help.

I feel this has something to do with plugin dependencies not getting calculated properly and hence the metatag_views module is not getting added, not 100% sure on this though.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
4.25 KB

How's about this?

Status: Needs review » Needs work

The last submitted patch, 33: metatag-n2927551-33.patch, failed testing. View results

DamienMcKenna’s picture

That suggests the dependencies can't be modified on a config object using the get()/set() methods. So what's the best approach?

tdnshah’s picture

The patch in #33 is also not helping to solve the drush si issue.

tdnshah’s picture

Hi All,
Still struggling to resolve this, requesting direction towards the resolution or even a work around would help for now ?
Thanks in advance..

DamienMcKenna’s picture

Issue tags: +Needs tests

I think the first step would be to add a new install profile that adds Metatag Views to the install profile, then we can have something to debug.

DamienMcKenna’s picture

Assigned: Unassigned » DamienMcKenna

Going to try creating an install profile..

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
9.43 KB

WIP.

DamienMcKenna’s picture

Assigned: DamienMcKenna » Unassigned
Status: Needs review » Needs work

We first need to make the tests fail.

gilmord’s picture

+1 for this to be solved, I face exactly the same issue with simple_sitemap also, looks like the problem is general and more likely related to core as multiple modules struggling with it

Attaching the issue in case it will be solved earlier

AaronMcHale’s picture

As far as I can tell, at least part of the issue is that the metatag_views module lists views as a dependency (which makes sense), but that means when installing from a profile, Drupal will try to install Views before installing Metatag Views, and with the `metatag_display_extender` plugin is listed in the `views.settings` config, at the point where Drupal tries to install Views, it sees that but because Metatag Views isn't installed at this point, as far as Drupal is concerned the metatag_display_extender plugin does not exist, so it fails.

Off the top of my head I can't think of a clean way around this.

DamienMcKenna’s picture

So maybe Views shouldn't cache its list of display extenders as a config object? Maybe this is ultimately a core issue?

DamienMcKenna’s picture

Title: The "metatag_display_extender" plugin does not exist » CORE BUG; The "metatag_display_extender" plugin does not exist