/

Laravel 11 queue jobs batch uses sqlite

If you’ve recently updated to Laravel 11 and suddenly had issues where some queued jobs are trying to use sqlite, I hope I can help.

Specifically, the issue I saw was with batched jobs. Batch jobs in Laravel use a database table. Always.

In a new Laravel 11 config/queue.php file, there is now a batching section, which defines where batched jobs should live.

'batching' => [
    'database' => env('DB_CONNECTION', 'sqlite'),
    'table' => 'job_batches',
],

If you are migrating from an older version of Laravel, this section may not exist. If it doesn’t exist, and you don’t have the DB_CONNECTION environment variable set (perhaps running CI in a GitHub action), then Laravel will fall back to sqlite.

So, either ensure DB_CONNECTION is always defined in every environment, or put this in your config/queue.php.

'batching' => [
    'database' => env('DB_CONNECTION', 'mysql'), # Fall back to mysql
    'table' => 'job_batches',
],