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

Fijvect's avatar

Yet Another Round of "Why is my route not defined?!"

There are SO MANY "Route not defined" threads, but I swear I've tried everything I can think of and that people have said, so I'm thinking I'm doing something stupid that I'm missing, lol.

Laravel 10.44

ERROR MESSAGE:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route [account.membership.claiming-no-user] not defined. in /var/www/html/Xerocraft/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:477

In my email blade template I have a component that references a route with this: \resources\views\emails\membershipPurchasedForOther:

@component('mail::button', ['url' => route('account.membership.claiming-no-user', [$membership->activation_code])])
    Activate Membership
@endcomponent

This is called from a queued Illuminate\Mail\Mailable, which is called from an event Listener.

The route is listed in web.php:

Route::group(['prefix' => 'account', 'as' => 'account.'], function() {
   Route::get('/claim/claim-membership/{code?}', 'Account\AccountMembershipController@claimShow')->name('membership.claiming-no-user');
});

IMPORTANT NOTES:

  • This is a new route! However this route DOES show up correctly when used in other places other than within this queuable mailable's view
  • There ARE other routes called in that view template and they're all working (including within other @components of the same type using the 'url' parameter in the same way)

THINGS I'VE TRIED:

  • Changing the url to something that would ABSOLUTELY be uniquely matched, just in case it was interfering with another route
  • Removing the url parameter completely from the route and controller and the view
  • php artisan cache:clear & php artisan route:clear
  • php artisan optimize
  • composer dump-autoload
  • swapping the route with a different one within the view and it then works correctly
  • Checking to make sure the route works in other locations (such as dumping it via DD inside of a random controller, just to make sure the route works in general).
  • Checking php artisan route:list. It shows the route with the correct controller and the correct method (GET):
 GET|HEAD        [home url here]/account/claim/claim-membership/{code?} ............ account.membership.claiming-no-user › Account\AccountMembershipController@claimShow

Soooo yea, I'm VERY stumped

0 likes
3 replies
Ben Taylor's avatar
Level 35

Did you restart your queue worker?

1 like
Fijvect's avatar

@Ben Taylor THAT WAS IT! I knew it had to be something simple, lol. Thanks!!

Ben Taylor's avatar

My pleasure. It's one of those things that is easy to forget to do.

Please or to participate in this conversation.