Route [name] not defined
Your code asked for the URL of a named route that the router does not have. Fix the name, add it with ->name(), or rebuild a stale route cache.
- Message
- Route [dashboard] not defined.
- Exception
- Symfony\Component\Routing\Exception\RouteNotFoundException
What it means
Your code asked Laravel for the URL of a named route, through route(), redirect()->route() or to_route(), and no registered route has that name. Laravel cannot build a URL it does not know, so it throws instead of guessing. The name in square brackets is the name your code asked for, exactly as written.
Why it happens
- A typo, or a route that never got a name.
route('dashbord')fails, and so doesroute('dashboard')when the route was defined without->name('dashboard'). - A name prefix from a route group. Inside
Route::name('admin.')->group(...), a route namedusersis registered asadmin.users, soroute('users')fails. Route [login] not defined.Theauthmiddleware sends a guest to the route namedlogin. In an app without one, every guest who opens a protected page gets this error. Requests that expect JSON get a 401 instead.- A stale route cache. After
php artisan route:cache, Laravel reads its routes from the cache file, and a route you add later does not exist until you cache again. A view that links to the new route throws this error, and the new URL itself answers 404. - A route file that is never loaded. Laravel loads the files named in
withRouting()inbootstrap/app.php. A new file such asroutes/billing.phpis ignored until you register it there.
How to fix it
First check which names the router actually has:
php artisan route:list --name=dashboard
For a typo or a missing name, give the route its name, or correct the call:
Route::get('/dashboard', [DashboardController::class, 'show'])->name('dashboard');
For a group prefix, use the full name: route('admin.users'). The prefix is added exactly as written, so the group needs the trailing dot in name('admin.').
For login, add a route named login, or tell Laravel where to send guests in bootstrap/app.php:
return Application::configure(basePath: dirname(__DIR__))
->withMiddleware(function (Middleware $middleware): void {
$middleware->redirectGuestsTo('/login');
})
->create();
For a stale cache, clear it, and rebuild it in your deploy after the new code is in place:
php artisan route:clear
php artisan route:cache
For a file that is not loaded, register it with the then closure:
use Illuminate\Support\Facades\Route;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
then: function () {
Route::middleware('web')->group(base_path('routes/billing.php'));
},
)
->create();
Find it in production
A visitor gets a 500 response, and with APP_DEBUG=false that is the plain "Server Error" page. Laravel reports this exception: RouteNotFoundException is not on the internalDontReport list in the framework's exception handler, so it is written to storage/logs/laravel.log at error level with its stack trace. When the route() call sits in a Blade view, the log names Illuminate\View\ViewException with the same message plus the view's path, and the route exception appears as the previous exception. Ranetrace error monitoring records the exceptions Laravel reports, with the stack trace and the request they happened on.
Reproduced on Laravel 13.45, PHP 8.5, 5 December 2026.
Related
Read more
Start monitoring today
Websites go down and code throws errors. Ranetrace tells you when it happens to yours, why it matters and what to do next.