LARAVEL/PHP

Laravel Queue Not Working? Diagnose Stuck Jobs and Failed Workers

Trace stuck or failed Laravel jobs from dispatch through the queue backend and worker, then apply a safe, version-aware fix.

Quick answer

Check that the job was dispatched to the expected connection and queue, then confirm a worker using that same connection and queue is running. Inspect pending, reserved, and failed work before retrying; a sync connection runs inline and needs no worker.

Laravel Queue Not Working? Diagnose Stuck Jobs and Failed Workers

Laravel Queue Not Working? Diagnose Stuck Jobs and Failed Workers

If a Laravel job is not running, first confirm the job is actually queued, identify the connection and queue name that received it, and check that a live worker is listening to that same connection and queue. Then inspect the job's availability/reservation state or Laravel's failed-job record before retrying it. A sync connection runs work in the request instead of placing it in a background queue, so it does not need a worker.

This guide uses Laravel 10 syntax as its documentation baseline. The Blueleaf repository checkout inspected for this review runs Laravel Framework 10.48.29 and declares PHP ^8.1; that does not establish the framework or PHP version deployed to Blueleaf's web or worker processes. Laravel 10 supports PHP 8.1–8.3; Laravel 13 requires PHP 8.3 or later and uses a newer database queue migration generator. Laravel 10 security support ended on 2025-02-04, so this documents an existing framework version, not a recommendation to start a new deployment on an unsupported release. Confirm the installed framework and PHP binaries before applying release-specific commands or planning an upgrade. Laravel 10 release notes list the support range and dates; Laravel 13 release notes state its PHP minimum.

Symptoms and common error messages

Queue trouble can look different depending on where a job stops:

  • The request succeeds, but an email, export, notification, or other background effect never appears.
  • Rows accumulate in a database jobs table or Redis queue.
  • A worker starts, prints little or no output, and leaves jobs waiting.
  • The same job runs more than once or is repeatedly released.
  • php artisan queue:failed lists a job with an exception.
  • A worker exits with a timeout, memory error, connection error, or Class ... not found after a deployment.
  • A job dispatched to a named queue such as emails is never picked up by a worker listening only to default.
  • With QUEUE_CONNECTION=sync, the request itself is slow or returns an exception from the job instead of creating a background job.

The message alone rarely identifies the cause. A “connection refused” error points toward a backend or network problem; an empty failed-job list does not prove the queue is healthy because the job may still be pending, may be running synchronously, or failed without persistent failure storage.

How Laravel queues work

Laravel separates a connection from a queue. A connection selects a backend such as Redis, a database table, Amazon SQS, sync, or null. A queue is a named set of jobs within that backend, commonly default. The job is sent to the configured connection and queue; a worker must use the matching connection and listen to the queue that contains the job. See the Laravel 10 queue documentation for the connection/queue distinction and backend behavior.

A job implementing ShouldQueue is eligible for asynchronous processing. Laravel then pushes it to the chosen backend. A long-running queue:work process reserves a job, runs its handler, and deletes it on success. If the handler throws, the worker may release and retry it according to attempts/backoff policy; after the retry limit it can be stored in failed_jobs, depending on the configured failure driver.

The sync driver is different: it executes the job inline in the current process. null discards jobs. Neither requires a background worker.

Common root causes

  1. No worker is running, or a supervisor/process manager stopped restarting it.
  2. The worker is using another connection, queue name, environment, release directory, or set of credentials.
  3. The application is configured for sync or null, not the backend the operator expects.
  4. Cached configuration still points to an old backend or queue name.
  5. The database jobs table or Redis service/credentials/network is unavailable.
  6. The job is delayed (available_at is in the future), reserved by a worker, or waiting on a long-running job ahead of it.
  7. The worker is listening to the wrong queue, such as default while jobs are sent to emails.
  8. The job throws because of code, missing dependencies, invalid data, permissions, or an external service failure.
  9. The worker's timeout, attempts, retry_after, or process-manager settings are mismatched.
  10. A worker kept running old code after deployment, or jobs are dispatched inside a database transaction and read records before they commit.

Diagnose in order

1. Confirm the effective connection and queue

Inspect your application's config/queue.php and the environment used by the web process and worker. On Laravel 10, a useful local diagnostic is:

php artisan tinker --execute="dump(['connection' => config('queue.default'), 'settings' => array_intersect_key(config('queue.connections.'.config('queue.default'), []), array_flip(['driver', 'queue', 'retry_after', 'block_for']))]);"

It prints the effective connection plus selected non-secret settings; it does not dump credentials. Run it in the application checkout/environment you intend to inspect. The web request and CLI worker must boot the same release and environment; checking a developer's local configuration does not prove what a production worker loaded.

Compare the three values explicitly:

Setting Example Must match
Connection redis or database The backend that receives the job
Queue default or emails The queue name passed to dispatch and worker
Environment/release staging release path, production release path The code and configuration used by the web process

If a job's effective connection is sync (often because QUEUE_CONNECTION=sync is the default), expect work to happen during the request. Look for a slow request or a thrown exception there; starting queue:work will not move a synchronous job into a background queue. A job can explicitly select another connection, so check job-specific routing too. If the effective connection is null, the configured driver intentionally discards jobs.

2. Confirm that dispatch is asynchronous

Check that the job implements Illuminate\Contracts\Queue\ShouldQueue and that code dispatches the job rather than directly calling its handler. For example:

use App\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class SendReceipt implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function __construct(public Order $order)
    {
    }

    public function handle(): void
    {
        // Send the receipt for $this->order using the application's mail service.
    }
}

Then dispatch it with SendReceipt::dispatch() or the application's equivalent. If it is routed to a special queue, make that explicit:

SendReceipt::dispatch($order)->onQueue('emails');

The onQueue call changes the queue name; it does not start a worker. Check job-specific onConnection, delays, middleware, and queue routing as well as the global default.

3. Check the worker and its exact options

Run this in a controlled development or staging environment to process one eligible job and exit:

php artisan queue:work redis --queue=emails,default --once -v

Replace redis with the configured connection and emails,default with the queues actually used. --once processes at most one job and exits; it still executes that job, so do not point it at production or a queue with consequential work unless you are authorized and intend to process the next eligible job. In Laravel 10, verbose worker output identifies the job class and job ID; it does not report the connection or queue. Confirm those from the worker command/configuration and backend or service monitoring. If no job is reported, verify connection, queue, delay, and backend state. Laravel's worker documentation describes worker options and output behavior.

For a persistent worker, a simpler baseline is:

php artisan queue:work redis --queue=emails,default --tries=3 --timeout=55

This worker checks emails before default, allows up to three attempts unless the job class sets its own attempt policy, and uses a 55-second worker timeout unless a job defines a timeout that takes precedence. Laravel 10 requires the pcntl PHP extension to enforce job timeouts; verify it is available to the worker's PHP binary. Blocking I/O also needs timeouts configured in the relevant client. Confirm the connection's retry_after (or the backend visibility timeout) exceeds the effective job timeout by several seconds. Laravel warns that if timeout exceeds retry_after, a job can be made available again while the original worker is still processing it, which can produce duplicate work. Laravel timeout guidance covers these requirements.

On Linux, check whether the expected process is present:

ps -eo pid,etime,args | grep '[q]ueue:work'

Verify the process command line's project path and any explicit connection or queue options. If those options are omitted, confirm the effective configured defaults instead. On servers managed by Supervisor, inspect the program status and recent logs with the server administrator's approved commands (for example, supervisorctl status). A manually started worker is not a production process manager: it exits when the terminal/session ends.

4. Check application and worker logs

Review the Laravel log for the same time window as the enqueue attempt and worker run. In a typical Laravel install:

tail -n 200 storage/logs/laravel.log

Look for the first exception and its context, not just later retries. Also inspect the process manager's worker output and the backend's service logs. Protect payloads, personal data, and tokens; failed-job payloads and exceptions can contain sensitive values, so restrict access and retention.

5. Inspect failed jobs before retrying

Laravel 10 can list persistent failures with php artisan queue:failed; the official failed-job instructions describe the returned identifiers and retry flow:

php artisan queue:failed

The result includes failure ID, connection, queue, and time. Inspect the matching exception and fix the cause first. The failed-job record shows Laravel marked the job as failed; it does not by itself prove that the worker exhausted the maximum-attempt limit, since application code can manually fail a job. Inspect the stored exception and logs or attempt history if available, then determine whether retrying is safe. Laravel 10 documents manual job failure.

Retry a single job only after checking whether its handler already made an external change:

php artisan queue:retry 4c866a69-3d20-4b5a-8ca5-6f171221c3e2

The UUID above is illustrative; replace it with the identifier shown by queue:failed for your job. The retry requeues the job; it may repeat a payment, email, webhook, or other side effect if the job is not idempotent. Avoid queue:retry all as a first diagnostic response. Do not use queue:flush or queue:clear to “unstick” work; those commands delete queued or failed work rather than repair the worker.

Connection and configuration checks

Check config caching and process environment

Laravel reads environment values into configuration files. If configuration is cached, editing .env alone will not change the effective values used by Artisan/web requests. Confirm the deployment release and cache state. In local development only, after reviewing the effect on that application, php artisan config:clear removes the cached configuration so Laravel can load current settings. In deployment, use the release's normal configuration-cache process rather than changing production configuration ad hoc.

Compare environment variables as seen by the web and worker processes. A worker launched from a different working directory, old release symlink, container, service account, or environment file can use different database, Redis, AWS, or queue credentials.

Database queue

The database driver needs the configured jobs table (normally jobs) in the selected database. In Laravel 10, generate a migration with php artisan queue:table, review it, and apply it only to the intended development database with php artisan migrate. These commands change schema; do not run migrations against production as a troubleshooting experiment. Check config/queue.php for the table and queue names and confirm the worker can connect to the same database as the dispatching application. See Laravel 10's database queue instructions.

If you have authorized read access, a database inspection can show whether jobs are pending, delayed, or reserved. Adjust the table name and SQL dialect to your schema:

SELECT id, queue, attempts, reserved_at, available_at, created_at
FROM jobs
ORDER BY id
LIMIT 20;

queue should match the worker's queue. A future available_at indicates a delayed job. With Laravel 10's standard generated migration, reserved_at, available_at, and created_at are integer Unix timestamps, not SQL DATETIME values. A non-null reserved_at indicates a worker reserved the row; if the worker died, compare its age with the configured retry_after before taking action. Confirm your actual migration before interpreting values. Do not manually delete or rewrite queue rows without understanding the reservation protocol and preserving a recovery path.

The failed_jobs table is separate from jobs. A project may have a failed-job migration but still lack the jobs migration. For a Laravel 10 project without failed-job storage, the generator is php artisan queue:failed-table (then review and migrate the generated file in the correct environment). Laravel 13 uses php artisan make:queue-table and php artisan make:queue-failed-table; check the release-specific documentation before applying generator commands to another version.

Redis queue

Confirm the Redis service is reachable from the worker host, the configured Redis connection, password/TLS settings, database number, and any key prefix are correct. The Redis queue connection and a Redis cache connection may be distinct. Verify that web and worker instances use the intended key prefix and queue name. In a cluster, follow Laravel's Redis queue requirements for hash tags.

Use the Laravel worker's verbose output and your Redis/service monitoring to confirm jobs arrive and workers consume them. Avoid guessing internal Redis key names or running manual DEL, FLUSHDB, or queue-key edits; these can erase unrelated cache or queued work. If Redis is shared, identify the exact application prefix and queue before inspecting anything.

Failed-job recovery and safe fixes

Match the repair to the evidence:

  • No worker process: start the configured worker in a controlled environment; in production restore its process-manager supervision and check why it stopped.
  • Wrong queue/connection: align the worker command with the connection and queue used at dispatch, or deliberately change routing in application code.
  • Stale config: correct the intended environment/release configuration and rebuild/clear its cache using the deployment procedure; restart long-lived workers afterward.
  • Backend connection error: repair host, port, credentials, TLS, firewall, or service health; do not silently switch to sync or null to hide it.
  • Missing jobs table: create/review the version-appropriate migration and apply it only to the confirmed local/test database or approved deployment process.
  • Application exception: fix the handler or dependency, add regression coverage where appropriate, then retry only the affected jobs whose side effects are safe.
  • Timeout or duplicate processing: right-size the job, worker timeout, attempts, and backend retry_after; make external effects idempotent where possible.
  • Job dispatched inside a transaction: if it depends on committed rows, use the queue connection's after_commit option or dispatch that job with ->afterCommit() where supported by the installed version.
  • Worker holds old code: restart workers gracefully after deployment and ensure a process manager brings them back.

For Laravel 10 and 13, php artisan queue:restart asks workers to exit gracefully after their current job. It uses the cache for its restart signal, so the relevant cache connection must work and the process manager should restart the worker. Run this only in the intended application environment; it is not a substitute for configuring a process monitor.

Verify the fix

After correcting the evidenced cause, use a harmless, identifiable job in a local or staging environment. Confirm:

  1. The job is routed to the expected connection and queue.
  2. The queue backend accepts it.
  3. A worker with matching options reports processing it.
  4. The intended result occurs once, and the job disappears from pending work.
  5. No new failed-job entry or repeated exception appears.
  6. The process manager keeps the worker running after an intentional graceful restart.

Do not claim a successful production fix based only on a clean command exit. Validate the user-visible effect and the absence of duplicate side effects.

Production prevention and monitoring

  • Run long-lived workers under a process manager such as Supervisor or the platform's equivalent; set the correct project path, PHP binary, environment, user, queue, and restart policy.
  • Set job attempts, backoff, timeout, and retry_after deliberately. Make jobs safe to retry with idempotency keys or duplicate detection when they call external systems.
  • Emit structured job-failure logs and alerts with job class/ID and safe correlation data, not secrets or full personal payloads.
  • Monitor pending depth and oldest-job age as well as failed-job count. A low count can still hide one very old job.
  • Alert on worker process loss, backend connectivity, sustained queue growth, and repeated job failure. Test the alert path.
  • Restart workers on deployment so they load the new release. Verify the process manager then restores expected worker count.
  • Configure a retention policy for failed records that respects investigation needs and privacy obligations.
  • If jobs are dispatched within database transactions, select an explicit after-commit behavior so workers do not race uncommitted data.

Common mistakes

  • Starting queue:work while the application is still configured for sync.
  • Running queue:work on default when jobs are sent to emails.
  • Assuming an existing failed_jobs table means a database jobs table also exists.
  • Changing .env while config is cached or while a different release/container is serving traffic.
  • Setting worker timeout longer than the backend's retry/visibility window.
  • Retrying every failed job before checking whether the first attempt completed an external side effect.
  • Clearing the queue to remove a reservation, thereby deleting valid work.
  • Running a worker in a terminal and assuming it will stay alive in production.
  • Treating a successful queue:work --once with no job processed as proof that the queue is fixed.
  • Claiming an example was tested because it appears in documentation.
Share
← Back to all articles

BLUELEAF INSIGHTS

Explore more on software engineering and application security.

Browse all articles