{"id":"821b159748adc5e0","repo":"laravel/framework","slug":"unsupported-driver-driver","errorCode":null,"errorMessage":"Unsupported driver [{$driver}].","messagePattern":"Unsupported driver \\[(.+?)\\]\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Connectors/ConnectionFactory.php","lineNumber":314,"sourceCode":"     * @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)) {\n            return $resolver($connection, $database, $prefix, $config);\n        }\n\n        return match ($driver) {\n            'mysql' => new MySqlConnection($connection, $database, $prefix, $config),\n            'mariadb' => new MariaDbConnection($connection, $database, $prefix, $config),\n            'pgsql' => new PostgresConnection($connection, $database, $prefix, $config),\n            'sqlite' => new SQLiteConnection($connection, $database, $prefix, $config),\n            'sqlsrv' => new SqlServerConnection($connection, $database, $prefix, $config),\n            default => throw new InvalidArgumentException(\"Unsupported driver [{$driver}].\"),\n        };\n    }\n}\n","sourceCodeStart":296,"sourceCodeEnd":318,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Connectors/ConnectionFactory.php#L296-L318","documentation":"Thrown by ConnectionFactory::createConnection() when the driver passed to it has no matching Connection subclass and no registered Connection::resolver. This is the connection-class counterpart to the connector error: it triggers after the PDO link was already built.","triggerScenarios":"createConnector() succeeded (e.g. because a 'db.connector.{driver}' binding exists or the driver is recognized), but createConnection() cannot map the same driver to a Connection class. Happens when a package registers only the connector half of a driver, or when a driver name passes the connector list but not the connection list.","commonSituations":"Custom driver package that registered a connector but forgot Connection::resolver('oci', fn (...) => new OracleConnection); typo'd driver; mismatch between connector bindings and connection resolvers.","solutions":["Use one of the built-in drivers (mysql, mariadb, pgsql, sqlite, sqlsrv).","For a custom driver, register both halves: the connector binding AND Connection::resolver($driver, fn (...) => new YourConnection(...)).","Correct the driver string typo in DB_CONNECTION / database.php.","After fixing config, run php artisan config:clear."],"exampleFix":"// before\nConnectionFactory - connector registered but no resolver; createConnection falls through.\n\n// after\n\\Illuminate\\Database\\Connection::resolver('oci', fn ($conn, $db, $prefix, $config) => new \\Acme\\OracleConnection($conn, $db, $prefix, $config));","handlingStrategy":"validation","validationCode":"$supported = ['mysql','mariadb','pgsql','sqlite','sqlsrv'];\nif (! in_array($driver, $supported, true) && ! \\Illuminate\\Database\\Connection::getResolver($driver)) {\n    throw new \\RuntimeException(\"No Connection resolver for driver [$driver].\");\n}","typeGuard":"function hasConnectionResolver(string $driver): bool {\n    return \\Illuminate\\Database\\Connection::getResolver($driver) !== null;\n}","tryCatchPattern":null,"preventionTips":["Register both a connector binding AND Connection::resolver() for custom drivers.","Prefer built-in drivers when possible.","Add a smoke test that opens one connection per configured driver.","Keep connector and connection resolvers in the same service provider."],"tags":["configuration","driver","connection","abstraction"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}