Score:1

Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, boolean given

ky flag

Ubuntu 18.04.6
Apache2, Postgresql 10, Drupal 8.9.6, PHP 7.2.34 (most of the modules require these versions)

I've tried trouble shooting this problem for multiple weeks. I'm attempting to migrate a drupal website to our local server but keep running into this error.

So far I've looked into the Php version issues posted here (switched to php 7.3/7.4 and tried 8.0)
https://www.drupal.org/project/drupal/issues/3152660
Tried the solutions here, Symfony Routing Error
and I've reinstalled modules using composer

Found out that the website works when I use a mysql database server but we cant use that since the scripts on the site are formatted for a postgresql database. When I try to use the postgresql server I get this error when I try to access the website.

The website encountered an unexpected error. Please try again later.
TypeError: Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, boolean given, called in /var/www/html/regotoolbox/web/core/lib/Drupal/Core/Routing/RouteProvider.php on line 382 in Symfony\Component\Routing\RouteCollection->add() (line 75 of vendor/symfony/routing/RouteCollection.php).
Symfony\Component\Routing\RouteCollection->add('system.404', ) (Line: 382)
Drupal\Core\Routing\RouteProvider->getRoutesByPath('/system/404') (Line: 182)
Drupal\Core\Routing\RouteProvider->getRouteCollectionForRequest(Object) (Line: 239)
Drupal\Core\Routing\Router->getInitialRouteCollection(Object) (Line: 123)
Drupal\Core\Routing\Router->matchRequest(Object) (Line: 116)
Drupal\Core\Routing\Router->match('/system/404') (Line: 157)
Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object, '/system/404', 404) (Line: 122)
Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->on404(Object) (Line: 109)
Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object, 'kernel.exception', Object)
call_user_func(Array, Object, 'kernel.exception', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exception', Object) (Line: 227)
Symfony\Component\HttpKernel\HttpKernel->handleException(Object, Object, 1) (Line: 79)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The main difference from the other drupal issues linked above is the system.404 that the routing is trying to add in the first line of the error. It would make sense if it was having trouble connecting to the database but I've verified several times that the database is working and connectable. Can't find anything else referencing this type of error so I've turned to asking here.

Thanks for your help!

id flag
https://drupal.stackexchange.com/questions/313173/symfony-routing-error
id flag
Oh, you already noticed that other question.
id flag
Have you debugged `getRoutesByPath` and looked into what is actually stored in the database table, in particular the `route` column? This actually looks a bit like https://www.drupal.org/project/drupal/issues/3152660 in terms of the serialization issues mentioned within. It is necessary to know what is in that column for the `system.404` route.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.