# 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:

```text
Route [dashboard] not defined.
```

Exception:

```text
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 does `route('dashboard')` when the route was defined without `->name('dashboard')`.
- A name prefix from a route group. Inside `Route::name('admin.')->group(...)`, a route named `users` is registered as `admin.users`, so `route('users')` fails.
- `Route [login] not defined.` The `auth` middleware sends a guest to the route named `login`. 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()` in `bootstrap/app.php`. A new file such as `routes/billing.php` is ignored until you register it there.

## How to fix it

First check which names the router actually has:

```bash
php artisan route:list --name=dashboard
```

For a typo or a missing name, give the route its name, or correct the call:

```php
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`:

```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:

```bash
php artisan route:clear
php artisan route:cache
```

For a file that is not loaded, register it with the `then` closure:

```php
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](/features/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.

Read more: https://laravel.com/docs/routing

## Related

### Terms

- [Named routes in Laravel](https://ranetrace.com/glossary/named-routes-in-laravel.md)
- [Middleware in Laravel](https://ranetrace.com/glossary/middleware-in-laravel.md)

### Other errors

- [The GET method is not supported for route](https://ranetrace.com/error-guides/laravel-method-not-supported-for-route.md)
- [Target class does not exist](https://ranetrace.com/error-guides/laravel-target-class-does-not-exist.md)

Read this guide in a browser: https://ranetrace.com/error-guides/laravel-route-not-defined
