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

Command icon 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

wamwam created an issue. See original summary.

wamwam’s picture

Issue summary: View changes
wamwam’s picture

Priority: Normal » Critical

f0ns made their first commit to this issue’s fork.

f0ns’s picture

Ran into the metatag_routes error on a Drupal 11.4 site, so I opened an MR for it.

MetatagHooks asks for MetatagRoutesHelperInterface, 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.

f0ns’s picture

Status: Active » Needs review
artemuss1990’s picture

I’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?

f0ns’s picture

Mistakes happen, I'm sure they didn't do it on purpose.

Did you test the MR? It fixed it for me.

jaypan’s picture

How can they release such a buggy update for a production environment?

It 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.

jaypan’s picture

Status: Needs review » Reviewed & tested by the community
f0ns’s picture

Thanks for testing!

damienmckenna’s picture

Title: Metatag 2.2.1 causes service container errors on Drupal 10.6.20 » Missing MetatagRoutesHelperInterface service
Parent issue: » #3632962: Plan for Metatag 2.2.2

I'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.

  • damienmckenna committed b35df179 on 2.2.x authored by f0ns
    Issue #3632995 by wamwam, f0ns, jaypan, DamienMcKenna: Missing service...
damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thank you.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

anybody’s picture

Just ran into this. Will you tag a release today @damienmckenna?

damienmckenna’s picture

Yes.

jaypan’s picture

Thanks for the quick turnaround on this.

Status: Fixed » Closed (fixed)

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