Problem/Motivation

Trying to upgrade a site from Drupal 8.9 to Drupal 9.x. The site uses Content Moderation and is multilingual.

Once all the Drupal 9.x files are in place, launching a cache rebuild or the database updates will fail early in the process with the message No converter has been registered for paramconverter.latest_revision.

This is because a route rebuild is triggered early, and Content Moderation in D8 sets a "converter" parameter for many entity routes to paramconverter.latest_revision, and Drupal will try to load this converter.

Unfortunately, the paramconverter.latest_revision converter has been removed in Drupal 9.0, see #3093219: Remove content_moderation.module BC layers, so the converter cannot be loaded and it causes the upgrade process to fail.

As a temporary fix, I overrode the service paramconverter_manager with a custom service which overrides ParamConverterManager::getConverter() with a version that returns paramconverter.entity whenever paramconverter.latest_revision is requested.

It allowed me to perform the upgrade to Drupal 9, then I got rid of the custom service.

Steps to reproduce

TBA
Not reproducible with just Drupal core, #4
Reproducible with Acqui Lightning #14

Proposed resolution

Workaround this problem by temporarily adding a paramconverter service. Read the implementation details..

Other workarounds reported to work.
a) Clear cache #7, #17
b) On a complex site writing a custom ParamConverterManager worked #12
c) entity.node.canonical route from the router table in the database, #18
d) drush updb then drush cr, #19, #20

Remaining tasks

Find out if this is still blocking sites from updating
and
Steps to reproduce with Drupal Core

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mdupont created an issue. See original summary.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jabastin arul’s picture

I am also facing the same issue

mdupont’s picture

Issue tags: +Upgrade path, +D9 upgrade path

I assume it should be fixed as part of the D8 -> D9 upgrade path. Tagging accordingly.

Where would be a good way to start fixing this? A hook_update_N() is likely to trigger too late.

cilefen’s picture

Priority: Normal » Major
mdupont’s picture

Status: Active » Closed (cannot reproduce)

Just retested this on a clean install. Cannot reproduce the issue with Drupal Core only when upgrading between 8.9.x and 9.1.x.

Maybe the issue was fixed in the meantime or was caused by a 3rd-party or custom module.

This is what I've done:
- Clone the latest Drupal 8.9.x from git
- Run composer install
- Install on SQLite DB, in English, standard profile
- Enable all the modules except experimental ones
- Add French as an additional language
- Enable Content Moderation editorial workflow for Article content type
- Enable Content Translation for Article nodes
- Create an Article, as published
- Edit the Article, put it in Draft
- Check that we land on the "Latest version" tab
- Translate the article in French, as published
- Edit the Article in French, put it in Draft
- Check the DB: in the router table, for entity.node.canonical, in the route column, converter is set to paramconverter.latest_revision
- Switch to the 9.1.x branch or the git repo
- Run composer install
- Visit update.php and run the updates
- Everything was correctly updated to Drupal 9.1.x
- Check the DB again: in the router table, for entity.node.canonical, we now have in the route column paramconverter.entity, which means it was correctly upgraded

bburg’s picture

I just ran into this error. In my case, it seemed that I wasn't able to rebuild the cache due to other errors in code that wasn't fully ready for D9. Once I fixed those, and I was able to rebuild the cache, I was able to get a working site.

greg boggs’s picture

Someone in #support also has this error in their D8 to D9 upgrade.

greg boggs’s picture

Status: Closed (cannot reproduce) » Active
greg boggs’s picture

I've asked the affected person to provide more details in how to replicate this error.

avpaderno’s picture

mdupont, who created this bug report, said he hasn't been able to replicate the issue with only Drupal core modules, which seems to indicate it's not a bug in Drupal core.
It could also be Drupal code is assuming some conditions are verified when it's not so. Understanding if this is the case would help.

mdupont’s picture

Indeed, I got the issue once on a fairly complex multilingual site with content moderation enabled, but could not reproduce it with Drupal core only, or simpler websites.

Writing a custom ParamConverterManager is the fix that worked.

longwave’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

If someone can provide steps to reproduce from a clean install, or identify contrib or custom code that triggers this problem, we can see if it is possible to provide a fix in core.

jerdavis’s picture

I'm having this issue on a Drupal 8 to Drupal 9 upgrade as well. This site was built with Acquia Lightning as the install profile and all modules were updated for d9 compatibility before trying to upgrade core. I haven't been able to track this to a particular contrib module, but of course Lightning does have aspects that touch on content moderation.

jerdavis’s picture

@mdupont do you have a copy of your custom code you'd be willing to share?

mdupont’s picture

Unfortunately not. At the time I traced it down to the route rebuild that occurs when doing a cache rebuild or update.php, without being able to pinpoint a specific module or part of the stack that was causing the issue. It might have been something in the code, or elsewhere in the stack (Redis, PHP opcache configuration...), or even something with the data stored in the database.

hatuhay’s picture

Got this error upgrading from D8.9.18 to D9.6.2, fixed cleaning caches.

jerdavis’s picture

Clearing cache did not fix for us, I was able to work around it by deleting entity.node.canonical route from the router table in the database.

loopy1492’s picture

In our case, we solved the issue with an updb and cr. However, your page might be stuck in another cache layer since you visited the page when it was busted. Be sure to clear varnish and whatnot after you run your drush commands.

alphex’s picture

Just confirming that I saw this also. 8.9.19 -> 9.2.9

running a DRUSH UPDB and then running DRUSH CR solved the problem.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alvarito75’s picture

I'm upgrading Drupal 8.9.20 => 9.3.5

I'm facing the same problem.

I did these steps:

  1. I followed this guide
  2. Then I run composer update, all went fine in the command line but when I try to use any drush command I got this error The entity type capability_highlight does not have an "revision_created" entity revision metadata key.

If I reload the site in the browser I got this error:

InvalidArgumentException: No converter has been registered for paramconverter.latest_revision in Drupal\Core\ParamConverter\ParamConverterManager->getConverter() (line 39 of core/lib/Drupal/Core/ParamConverter/ParamConverterManager.php)

mikemadison’s picture

I ran into this today as well, and was able to temporarily add a services.yml file to a module with the following contents, run database updates / cache rebuild, then remove the service. Note that the services file has to go into a module that is already enabled (because hey, drush and drupal won't bootstrap to enable a new module). You could theoretically also hack a core services file to do this (but that is less advised).

services:
  paramconverter.latest_revision:
    class: Drupal\Core\ParamConverter\EntityConverter
    tags:
      - { name: paramconverter }
    arguments: [ '@entity_type.manager', '@entity.repository' ]

Note: i did have to leave this in the code through production to finalize all updates.

rajab natshah’s picture

Facing the same issue
Thank you, Mike
Fixed by following the steps in #23

quietone’s picture

Issue summary: View changes

Update IS

Is anyone still experiencing this problem? If so, leave a comment.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jbaum_13’s picture

We also ran into this error on D8 to D9 upgrade and also fixed by following the steps in #23

x775’s picture

#25: I can confirm that we are seeing this error as well.

Is there a way to circumvent or otherwise patch this?

cilefen’s picture

#24 and #27 indicate that #23 is the workaround.

quietone’s picture

Title: paramconverter.latest_revision makes Drupal 9 upgrade impossible » No converter has been registered for paramconverter.latest_revision
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)

Updated the IS to emphasize the preferred workaround, #23. Also changed the title to the error message since that is what people will search for.

I don't there is more we can do here. And it has been nearly a year since the status was changed, waiting for steps to reproduce. I think it is time to close this (outdated).

If you arrive here and the workaround does not work for you, you can open a new issue. In that new issue refer to this one. The other option is to seek support in the other Drupal sources of support.

Thanks to everyone who contributed the solutions and tested them.

darktek’s picture

#23 worked for me, thanks man!