{"record":{"id":"4df788966fde45f2","repo":"laravel/framework","slug":"auth-driver-config-driver-for-guard-nam","errorCode":null,"errorMessage":"Auth driver [{$config['driver']}] for guard [{$name}] is not defined.","messagePattern":"Auth driver \\[(.+?)\\] for guard \\[(.+?)\\] is not defined\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Auth/AuthManager.php","lineNumber":103,"sourceCode":"    protected function resolve($name)\n    {\n        $config = $this->getConfig($name);\n\n        if (is_null($config)) {\n            throw new InvalidArgumentException(\"Auth guard [{$name}] is not defined.\");\n        }\n\n        if (isset($this->customCreators[$config['driver']])) {\n            return $this->callCustomCreator($name, $config);\n        }\n\n        $driverMethod = 'create'.ucfirst($config['driver']).'Driver';\n\n        if (method_exists($this, $driverMethod)) {\n            return $this->{$driverMethod}($name, $config);\n        }\n\n        throw new InvalidArgumentException(\n            \"Auth driver [{$config['driver']}] for guard [{$name}] is not defined.\"\n        );\n    }\n\n    /**\n     * Call a custom driver creator.\n     *\n     * @param  string  $name\n     * @param  array  $config\n     * @return mixed\n     */\n    protected function callCustomCreator($name, array $config)\n    {\n        return $this->customCreators[$config['driver']]($this->app, $name, $config);\n    }\n\n    /**\n     * Create a session based authentication guard.","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Auth/AuthManager.php#L85-L121","documentation":"Thrown by AuthManager::resolve() when a guard's config exists but its 'driver' value matches neither a registered custom creator nor a create{Driver}Driver method on the manager. The driver name is the strategy used to build the guard (session, token, sanctum, etc.), and unknown values cannot be resolved to a guard implementation.","triggerScenarios":"Defining a guard in auth.php with a 'driver' value that is not one of the built-ins (session/token) and is not registered via Auth::extend(); misspelling a driver like 'sesion'; using a package (e.g. Sanctum/Passport) that is not installed or booted.","commonSituations":"Removing Laravel Sanctum without updating guards still set to driver 'sanctum'; a typo in the driver string; referencing a custom driver before Auth::extend() runs in a service provider; config cache predating the package installation.","solutions":["Use a built-in driver that exists (session for web guards, token for API token guards).","Install/enable the package that provides the driver (e.g. composer require laravel/sanctum and ensure its ServiceProvider is registered).","Register a custom driver with Auth::extend('mydriver', fn (...) => new MyGuard(...)) before the guard is resolved.","Fix the typo in the 'driver' key of the guard config.","Run php artisan config:clear to drop a stale cached config."],"exampleFix":"// before\n'guards' => [\n    'api' => ['driver' => 'sanctum', 'provider' => 'users'], // Sanctum not installed\n],\n\n// after — install and register the package, or switch driver\n'guards' => [\n    'api' => ['driver' => 'session', 'provider' => 'users'],\n],\n// then: composer require laravel/sanctum && php artisan install:api","handlingStrategy":"validation","validationCode":"// PHP — confirm the driver is resolvable\n$name = 'api';\n$cfg = config(\"auth.guards.{$name}\");\n$driver = $cfg['driver'] ?? null;\n$method = 'create' . ucfirst((string) $driver) . 'Driver';\n$builtIn = in_array($driver, ['session','token'], true);\n$resolvable = $builtIn || method_exists(app(\\Illuminate\\Auth\\AuthManager::class), $method) || app(\\Illuminate\\Auth\\AuthManager::class)->hasCustomCreator($driver);\nif (! $resolvable) abort(500, \"Auth driver [{$driver}] is not supported.\");","typeGuard":"function authDriverIsResolvable(string $driver): bool {\n    return in_array($driver, ['session','token'], true)\n        || method_exists(app(\\Illuminate\\Auth\\AuthManager::class), 'create' . ucfirst($driver) . 'Driver');\n}","tryCatchPattern":"try {\n    Auth::guard('api');\n} catch (\\InvalidArgumentException $e) {\n    report('Auth driver not resolvable: '.$e->getMessage());\n    throw $e;\n}","preventionTips":["Install packages that provide custom drivers before referencing them.","Register custom drivers in a non-deferred service provider's boot().","Use 'session' or 'token' unless a custom driver is wired."],"tags":["authentication","guard","driver","laravel","configuration"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}