Skip to content

Issue during Drupal install: You have requested a non-existent service "router.route_provider"

If you select MongoDB as your destination database during install, you'll receive the following after hitting submit (tested on both 9.4.4 and 9.5.x):

The website encountered an unexpected error. Please try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "router.route_provider". in Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() (line 1030 of /usr/local/var/www/drupal9/vendor/symfony/dependency-injection/ContainerBuilder.php).

Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('router.route_provider') (Line: 40)
Drupal\Core\DependencyInjection\Compiler\DependencySerializationTraitPass->process(Object) (Line: 94)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object) (Line: 762)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1297)
Drupal\Core\DrupalKernel->compileContainer() (Line: 901)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 20)
Drupal\Core\Installer\InstallerKernel->initializeContainer() (Line: 822)
Drupal\Core\DrupalKernel->updateModules(Array, Array) (Line: 608)
Drupal\Core\Extension\ModuleInstaller->updateKernel(Array) (Line: 244)
Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, 1) (Line: 637)
drupal_install_system(Array) (Line: 1098)
install_base_system(Array) (Line: 700)
install_run_task(Array, Array) (Line: 571)
install_run_tasks(Array, NULL) (Line: 119)
install_drupal(Object) (Line: 48)

When I searched for information about this error, I stumbled across this super helpful comment: https://www.drupal.org/project/drupal/issues/3285888#comment-14564117 which points to mongodb.services.yml as the culprit.

Which is WEIRD because unlike that issue (where a service was deprecated and changed names), router.route_provider is alive and well in core.services.yml

Some kind of weighting issue, where the MongoDB driver's somwhow being loaded before core's services? 🤔

Edited by webchick