{"id":"ab7981240e83edfb","repo":"laravel/framework","slug":"unsupported-driver-config-driver","errorCode":null,"errorMessage":"Unsupported driver [{$config['driver']}].","messagePattern":"Unsupported driver \\[(.+?)\\]\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Connectors/ConnectionFactory.php","lineNumber":286,"sourceCode":"     * @throws \\InvalidArgumentException\n     */\n    public function createConnector(array $config)\n    {\n        if (! isset($config['driver'])) {\n            throw new InvalidArgumentException('A driver must be specified.');\n        }\n\n        if ($this->container->bound($key = \"db.connector.{$config['driver']}\")) {\n            return $this->container->make($key);\n        }\n\n        return match ($config['driver']) {\n            'mysql' => new MySqlConnector,\n            'mariadb' => new MariaDbConnector,\n            'pgsql' => new PostgresConnector,\n            'sqlite' => new SQLiteConnector,\n            'sqlsrv' => new SqlServerConnector,\n            default => throw new InvalidArgumentException(\"Unsupported driver [{$config['driver']}].\"),\n        };\n    }\n\n    /**\n     * Create a new connection instance.\n     *\n     * @param  string  $driver\n     * @param  \\PDO|\\Closure  $connection\n     * @param  string  $database\n     * @param  string  $prefix\n     * @param  array  $config\n     * @return \\Illuminate\\Database\\Connection\n     *\n     * @throws \\InvalidArgumentException\n     */\n    protected function createConnection($driver, $connection, $database, $prefix = '', array $config = [])\n    {\n        if ($resolver = Connection::getResolver($driver)) {","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Connectors/ConnectionFactory.php#L268-L304","documentation":"Thrown by ConnectionFactory::createConnector() when the configured 'driver' value does not match any of the built-in connectors (mysql, mariadb, pgsql, sqlite, sqlsrv) and no custom 'db.connector.{driver}' container binding exists.","triggerScenarios":"Passing a config with a driver string the framework doesn't recognize, e.g. 'oci' (Oracle), 'odbc', 'mongodb', or a typo like 'mysq'. The match expression falls through to the default case.","commonSituations":"Using a third-party driver package (Oracle/DB2/MongoDB) without registering its connector; a typo in DB_CONNECTION; casing mismatch ('MySQL' vs 'mysql'); pointing at a driver constant that resolved to something unexpected.","solutions":["Correct the driver string to one of: mysql, mariadb, pgsql, sqlite, sqlsrv.","If using a third-party driver, register it via $this->app->bind('db.connector.oci', fn () => new OracleConnector) before connecting.","Check for typos/casing in DB_CONNECTION and config/database.php.","Run config:clear if you recently changed the driver to discard stale cache."],"exampleFix":"// before (.env)\nDB_CONNECTION=mysq\n\n// after\nDB_CONNECTION=mysql","handlingStrategy":"validation","validationCode":"$supported = ['mysql','mariadb','pgsql','sqlite','sqlsrv'];\n$driver = config('database.connections.'.$name.'.driver');\nif (! in_array($driver, $supported, true) && ! app()->bound('db.connector.'.$driver)) {\n    throw new \\RuntimeException(\"Driver [$driver] for [$name] is unsupported / unregistered.\");\n}","typeGuard":"function isSupportedDriver(string $driver): bool {\n    return in_array($driver, ['mysql','mariadb','pgsql','sqlite','sqlsrv'], true);\n}","tryCatchPattern":null,"preventionTips":["Whitelist driver strings in config validation.","Register 'db.connector.{driver}' bindings before using third-party drivers.","Beware casing and typos in DB_CONNECTION.","Run config:clear after changing drivers."],"tags":["configuration","driver","connection"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}