After upgrading Metatag from 2.2.0 to 2.2.1 using Composer, the Drupal site became unavailable due to service container errors.
Environment
- Drupal core: 10.6.20
- PHP: 8.3.33
- Metatag: 2.2.1 (problematic version)
- Previous working version: Metatag 2.2.0
- Installation method: Composer
Steps to reproduce
1. Run `composer require 'drupal/metatag:^2.2'` to upgrade Metatag from 2.2.0 to 2.2.1.
2. Rebuild the Drupal cache using `drush cr`.
3. Observe the service container error.
Observed errors
`ServiceNotFoundException: You have requested a non-existent service "Drupal\metatag_views\Hook\ViewsHooks".`
Another error reported during cache rebuild:
`Cannot autowire service "Drupal\metatag_routes\Hook\MetatagHooks": argument "$metatag_routes_helper" references interface "Drupal\metatag_routes\Helper\MetatagRoutesHelperInterface" but no such service exists.`
The service `metatag_routes.helper` exists in `metatag_routes.services.yml`, but no alias for `MetatagRoutesHelperInterface` was present.
Workaround
Downgrading Metatag to 2.2.0 using Composer restored the site. After the downgrade, `drush cr` completed successfully.
Expected result
Metatag 2.2.1 should allow Drupal's service container to compile and the site to load without these exceptions.
Issue fork metatag-3632995
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
wamwam commentedComment #3
wamwam commentedComment #6
f0ns commentedRan into the metatag_routes error on a Drupal 11.4 site, so I opened an MR for it.
MetatagHooksasks forMetatagRoutesHelperInterface, but that interface was never registered as a service. The MR adds the missing alias.The other "non-existent service" errors in this issue cleared up for me after a
drush cr, so they look like a stale cache rather than a bug.Comment #7
f0ns commentedComment #8
artemuss1990 commentedI’m having the same issue after installing version 2.2.1 on Drupal 11.4. Clearing the cache doesn’t help. How can they release such a buggy update for a production environment?
Comment #9
f0ns commentedMistakes happen, I'm sure they didn't do it on purpose.
Did you test the MR? It fixed it for me.
Comment #10
jaypanIt happens. It's why you test before deployment. You can roll back to the previous version for now, or patch it.
Module developers are doing it by volunteer, out of the goodness of their hearts. This is open source.
The MR fixed it for me.
Comment #11
jaypanComment #12
f0ns commentedThanks for testing!
Comment #13
damienmckennaI'm sorry this bug slipped past and caused problems for you. It's weird that none of the automated tests found this error, given the change was committed almost two months ago.
Thank you for the fix, I'll get this out in a hotfix this morning.
Comment #15
damienmckennaCommitted. Thank you.
Comment #17
anybodyJust ran into this. Will you tag a release today @damienmckenna?
Comment #18
damienmckennaYes.
Comment #19
jaypanThanks for the quick turnaround on this.