Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mvind's avatar
Level 1

Unable to prepare route [logout] for serialization.

Hi

I can't run php artisan route:cache. I moved all my closures into controllers, but when I run the command I get the following error:

php artisan route:cache
Route cache cleared!

   LogicException

  Unable to prepare route [logout] for serialization. Another route has already been assigned name [logout].

  at vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:212
    208|             $route->name($name = $this->generateRouteName());
    209|
    210|             $this->add($route);
    211|         } elseif (! is_null($symfonyRoutes->get($name))) {
  > 212|             throw new LogicException("Unable to prepare route [{$route->uri}] for serialization. Another route has already been assigned name [{$name}].");
    213|         }
    214|
    215|         $symfonyRoutes->add($route->getName(), $route->toSymfonyRoute());
    216|

      +20 vendor frames
  21  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

When I run php artisan route:list I don't have any web or api routes with clojure actions.

Does anyone have a clue to fix this error? I have been banging my head against the wall and i'm at complete standstill.

After I got this error I can't consume my api anymore I get a error 401 Unauthorized.

0 likes
12 replies
mvind's avatar
Level 1

And if I run php artisan config:clear , php artisan route:clear I still get the error.

mvind's avatar
Level 1

|        | GET|HEAD | logout                                  | logout                            | App\Http\Controllers\Auth\LoginController@logout                          | web                                               |
|        | POST     | logout                                  | logout                            | App\Http\Controllers\Auth\LoginController@logout                          | web                                               |

I don't understand.. This is the logout routes, I have only used passport and now all of the sudden I get this error.

mvind's avatar
Level 1

I have only used passport. This is the default setup.

martinbean's avatar

@mvind Laravel does not register a GET route for logging out, so you must have added that somewhere.

mvind's avatar
Level 1

Yes you are correct, but I'm still having big problems with this--

martinbean's avatar

@mvind The problem will be resolved if you remove the second route named logout

Please or to participate in this conversation.