{"record":{"id":"c5cd88ff8edd98e9","repo":"laravel/framework","slug":"driver-config-driver-is-not-supported-c5cd88","errorCode":null,"errorMessage":"Driver [{$config['driver']}] is not supported.","messagePattern":"Driver \\[(.+?)\\] is not supported\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Cache/CacheManager.php","lineNumber":151,"sourceCode":"     * @return \\Illuminate\\Cache\\Repository\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function build(array $config)\n    {\n        $config = Arr::add($config, 'store', $config['name'] ?? 'ondemand');\n\n        if (isset($this->customCreators[$config['driver']])) {\n            return $this->callCustomCreator($config);\n        }\n\n        $driverMethod = 'create'.ucfirst($config['driver']).'Driver';\n\n        if (method_exists($this, $driverMethod)) {\n            return $this->{$driverMethod}($config);\n        }\n\n        throw new InvalidArgumentException(\"Driver [{$config['driver']}] is not supported.\");\n    }\n\n    /**\n     * Call a custom driver creator.\n     *\n     * @param  array  $config\n     * @return mixed\n     */\n    protected function callCustomCreator(array $config)\n    {\n        return $this->customCreators[$config['driver']]($this->app, $config);\n    }\n\n    /**\n     * Create an instance of the APC cache driver.\n     *\n     * @param  array  $config\n     * @return \\Illuminate\\Cache\\Repository","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Cache/CacheManager.php#L133-L169","documentation":"CacheManager::build dispatches to a create{Driver}Driver method (e.g., createRedisDriver) or to a custom creator registered via Cache::extend(). If neither exists for the configured 'driver' string, the build is aborted. The supported built-in drivers are: apc, array, database, file, dynamodb, memcached, redis, null (and 'session' for the session-backed cache).","triggerScenarios":"Setting CACHE_DRIVER=foo (or 'driver' => 'foo' in config/cache.php) where 'foo' is neither a built-in driver nor registered via Cache::extend('foo', ...). Also when a custom driver name was typo'd in config or in a Cache::extend() call.","commonSituations":"Missing PHP extension for a driver (e.g., 'memcached' without ext-memcached) — note this surfaces as a different error, but 'imaginary' driver names hit this one. Stale cached config from a deleted driver. Custom driver registered in a service provider that didn't load (provider not in config/app.php providers array).","solutions":["Set CACHE_DRIVER (or the 'driver' key in config/cache.php) to a supported value: apc, array, database, file, dynamodb, memcached, redis, or null.","If using a custom driver, register it via Cache::extend('your-driver', fn ($app, $config) => new Repository(...)) in a boot() method of a service provider that is actually registered.","Run php artisan config:clear to drop stale config cache after edits.","Verify the driver name spelling and case match exactly (ucfirst is applied, but the lookup key is the raw string)."],"exampleFix":"// before (config/cache.php)\n'stores' => [\n    'default' => [\n        'driver' => 'muyredis', // typo\n        'connection' => 'cache',\n    ],\n],\n\n// after\n'stores' => [\n    'default' => [\n        'driver' => 'redis',\n        'connection' => 'cache',\n    ],\n],\n\n// OR register a custom driver in AppServiceProvider::boot()\nCache::extend('myredis', function ($app, array $config) {\n    return Cache::repository(new \\My\\CustomRedisStore($config));\n});","handlingStrategy":"validation","validationCode":"// Validate the driver is supported before building\n$driver = config('cache.stores.default.driver');\n$supported = ['apc','array','database','dynamodb','file','memcached','redis','null','session'];\nif (! in_array($driver, $supported, true) && ! app(\\Illuminate\\Cache\\CacheManager::class)->hasCustomCreator($driver)) {\n    throw new \\RuntimeException(\"Cache driver [{$driver}] is not supported.\");\n}","typeGuard":"function cacheDriverIsSupported(string $driver): bool\n{\n    $builtIn = ['apc','array','database','dynamodb','file','memcached','redis','null','session'];\n    return in_array($driver, $builtIn, true)\n        || array_key_exists($driver, app(\\Illuminate\\Cache\\CacheManager::class)->getCustomCreators());\n}","tryCatchPattern":"try {\n    Cache::store('default')->get('key');\n} catch (\\InvalidArgumentException $e) {\n    if (str_starts_with($e->getMessage(), 'Driver [')) {\n        // fall back to array driver\n        return Cache::store('array')->get('key');\n    }\n    throw $e;\n}","preventionTips":["Whitelist cache driver values in env validation at boot (e.g., Laravel EnvValidator).","Register custom drivers in a dedicated CacheServiceProvider that is always loaded.","Run php artisan config:clear after every config edit in CI and on deploy.","Document supported driver values in the project README."],"tags":["cache","driver","configuration","service-provider"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}